[LLVMdev] Cross-compiling LLVM on Mac OS X

Rob Rix
Mon, 21 Dec 2009 20:32:07 -0000

Hello,

I’ve spent the past day or so attempting to get LLVM’s libraries built as a Mac
OS X-style universal binary, the first step of which is to get them built for
each component architecture (i386, x86_64, ppc, and ppc64).

The first two are straightforward as I am working on an x86_64 Mac (running Mac
OS X 10.6, which corresponds to Darwin 10), but building ppc binaries has thus
far eluded me. My attempts have been made with 2.6 and trunk with identical
results.

I have been using this command to configure it:

./configure --enable-optimized --enable-jit --build=x86_64-apple-darwin10
--host=powerpc-apple-darwin10

(Note that using darwin9 or just darwin doesn’t change matters.)

The configuration succeeds (up to a point—see below), and then I make it (using
the system’s included make command, which apparently is GNU Make 3.81). make
fails immediately with this message:

configure: error: Already configured in /Users/rob/Developer/External/llvm-trunk
make[1]: *** No targets specified and no makefile found.  Stop.
make: *** [cross-compile-build-tools] Error 1

Looking at the cross-compile-build-tools rule in the Makefile, I see that it
checks for a Makefile in the BuildTools directory, and if there is none, it goes
in there and runs the source directory’s configure script—at which point the
configure script errors because it was already configured in the source
directory.

I’m assuming I must be doing something wrong with the configuration, but I don’t
know enough about make in general and llvm’s build system specifically to
comment on whether the cross-compile-build-tools rule might be broken.

Thank you in advance for any light you can shed on this issue!

Sincerely,
Rob

P.S. One extra fly in the ointment is that I’m building against the Mac OS X
10.5 SDK on a 10.6 machine, to accomplish which I am setting CFLAGS to -isysroot
/Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5. Omitting this doesn’t
change the result, however.