Building Universal Binaries on MAC OS X with configure
I recently ran into a ton of problems while trying to build the latest version of Remobo as a universal binary with OS X 10.4 support on my MacBook Pro running 10.5. In the end, all the problems were solved by passing in the right compiler flags and configure parameters. Here is a quick rundown of what I learned. Hopefully it will help someone out in the future!
Our project uses configure and automake etc… so we did not have XCode to help us with the settings. This will be true for many open source projects and libraries you come across since they are mostly written for Linux.
1) Make sure to pass the right compiler flags.
For a universal binary, use:
CFLAGS="-arch ppc -arch i386"
LDFLAGS="-arch i386 -arch ppc"
If you also want backwards compatibility with a previous version of OS X (10.4 in this example), use something like:
CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386"
This will compile using the 10.4 SDK instead of the default 10.5 since I am runnign Leopard.
2) Pass in the right configure parameters.
Make sure to add this flag to configure:
./configure --disable-dependency-tracking
This will ensure there are no problems when compiling for multiple architectures.
3) Check your output binary.
You can use the “file” command to make sure everything went according to plan. If the binary is truly universal, you will see something like this:
file ./src/hello
src/hello: Mach-O fat file with 2 architectures
src/hello (for architecture i386): Mach-O executable i386
src/hello (for architecture ppc): Mach-O executable ppc
Hope that helps!
One last tip: make sure all the dependencies and libraries you are using are also compiled in this way or else you will get link errors since the linker cannot combine regular binaries with universal binaries.

I love my iPhone and MacBook Pro but I have to say that Apple’s quality control seems to be a bit lacking. Last night, my Macbook Pro’s screen suddenly went black and would not come back on. I tried a hard reboot,