Introduction

This type of compilation happens in two phases. The first phase is to compile separately for Intel and PPC architectures. The second phase is to create a binary that combines both architecture binaries.

Creating Binaries for Different Architectures

On Intel, I can compile with gcc like this:

  gcc -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk prog.c
  

For the Makefile, edit it and look for the following options to specify the architecture:

  -arch and -isysroot
  

Assembly

Once you have your two architecture binaries, you need to merge them:

  lipo -create ppc/prog i386/prog -output prog
  

Note: It seems that at the gcc compilation level, you can simply use the following options to avoid having to do the assembly step:

  -arch ppc -arch i386
  

Last updated 12 Jul 2007, 07:20 CEST. history