[LLVMdev] Cross-compiling LLVM on Mac OS X

Eric Christopher
Tue, 22 Dec 2009 00:17:51 -0000

On Dec 21, 2009, at 3:39 PM, Rob Rix wrote:

>> Anyhow, Rob, best bet is to just use -arch to build everything up. lipo
knows what needs to happen.
>
> Unfortunately that doesn’t appear to be enough; using -arch in CFLAGS (and
CXXFLAGS) and not using --build or --host builds for x86_64 no matter what you
specify for the architecture (in my case, the documented i386 and ppc).
>
> The full command I’m using is as follows:
>
> CFLAGS="-arch $cpu -isysroot /Developer/SDKs/MacOSX10.5.sdk/
-mmacosx-version-min=10.5" CXXFLAGS="-arch $cpu -isysroot
/Developer/SDKs/MacOSX10.5.sdk/ -mmacosx-version-min=10.5" ./configure
--enable-optimized --enable-jit --enable-targets=x86,x86_64,powerpc
>
> $cpu is i386 or ppc.
>
> 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.

Daniel's comments are also good.

-eric