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. -- Rob Rix, Unknown Quantity Monochrome Industries
Rob Rix <rob at monochromeindustries.com> writes: [snip] If your problem persists, maybe CMake can do the job: http://www.llvm.org/docs/CMake.html -- Óscar
> > 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 1You're going to need multiple configures and multiple build directories to do it that way. You may want to try just setting your CXXFLAGS to "-arch i386 -arch ppc -arch x86_64" or something. Out of curiosity, why are you trying to build ToT 3-way FAT for OSX? It's already built like that on the system. -eric
(My apologies for the double e-mail, Eric; I neglected to reply to the list.)>> 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 > > You're going to need multiple configures and multiple build directories to do it that way. You may want to try just setting your CXXFLAGS to "-arch i386 -arch ppc -arch x86_64" or something.I’m actually doing that presently with CFLAGS, but hadn’t considered the necessity of doing it with CXXFLAGS as well. Thank you!> Out of curiosity, why are you trying to build ToT 3-way FAT for OSX? It's already built like that on the system.I wasn’t aware of that. Are you referring to libLLVMCore.a & friends, or LLVM GCC? I wasn’t able to find the libraries in question in /usr/lib, /Developer, /System, or anywhere else I looked and searched. I am building a universal framework which needs to embed these libraries. Thanks very much, Rob -- Rob Rix, Unknown Quantity Monochrome Industries
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
>> 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-onlyI 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, Rob -- Rob Rix, Unknown Quantity Monochrome Industries