[LLVMdev] Cross-compiling LLVM on Mac OS X

Rob Rix
Tue, 22 Dec 2009 14:10:12 -0000

>> The configure script’s output says, near the top:
>>
>> checking target architecture... x86_64
>>
>> So it seems that the Makefile is preferring the configure script’s
reckoning to the CFLAGS/CXXFLAGS variables at present.
>
> configure really doesn't know about it. It's still the target
architecture. You'll just be adding more.
>
> Let the build go and see where you get.  Also, you need more than a single
-arch flag. As I said before -arch ppc -arch i386 -arch x86_64.

This results in x86_64 binaries only, unfortunately. However…

> Daniel's comments are also good.


…success!

> export UNIVERSAL=true
> export UNIVERSAL_ARCH="i386 x86_64 ppc ppc64"
> export UNIVERSAL_SDK_PATH=/Developer/SDKs/MacOSX10.5.sdk/
> export CFLAGS="-mmacosx-version-min=10.5"
> export CXXFLAGS="-mmacosx-version-min=10.5"
>
> ./configure --enable-optimized --enable-jit
--enable-targets=x86,x86_64,powerpc
> make libs-only

I suspect the problem with my earlier attempts was that I was exporting the
environment variables in question to configure, but not to make. Regardless,
this is nicely intention-revealing and very easy.

Thanks very much for your help, everyone; if no one objects, I will make a page
on the LLVM wiki about fat builds for OS X.

Sincerely,