[llvm-commits] [PATCH] better support for cross-hosted Darwin builds

Shantonu Sen ssen at apple.com
Wed Sep 2 10:03:58 PDT 2009


I would like (stick with me here) to build a ppc+ppc970 set of LLVM  
libraries for deployment on Mac OS X 10.5 PPC, and build it on a Mac  
OS X 10.6 Intel system.

I tried:
$ ../configure --build=x86_64-apple-darwin10 --host=powerpc-apple- 
darwin10 --target=powerpc-apple-darwin10 --enable-optimized CC="cc - 
arch ppc" CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx- 
version-min=10.5" CXX="c++ -arch ppc" CXXFLAGS="-isysroot /Developer/ 
SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5"
...
$ make CC="cc" CXX="c++" UNIVERSAL=1 UNIVERSAL_ARCH="ppc ppc970"  
UNIVERSAL_SDK_PATH="/Developer/SDKs/MacOSX10.5.sdk"  
DARWIN_VERSION=10.5 VERBOSE=YES -j8
...

The explicit CC/CFLAGS/CXX/CXXFLAGS is needed for the configure script  
so that autoconf checks work properly and attempt to do a single-arch  
ppc test for host features. During the "make" phase, I wanted to use  
the normal Darwin universal build support.

This ended up working poorly because the first thing the makefiles do  
is build BuildTools/ (including "tblgen") for the "build" architecture:

if [ ! -f BuildTools/Makefile ]; then \          /Volumes/HD/ltmp/ssen/ 
llvm/autoconf/mkinstalldirs BuildTools; \
	  cd BuildTools ; \
	  /Volumes/HD/ltmp/ssen/llvm/configure ; \
	  cd .. ; \
	fi; \
         (make -C BuildTools BUILD_DIRS_ONLY=1 ) || exit 1;
checking build system type... i686-apple-darwin10.0.0
checking host system type... i686-apple-darwin10.0.0
checking target system type... i686-apple-darwin10.0.0
...
c++ -I/Volumes/HD/ltmp/ssen/llvm/build/BuildTools/include -I/Volumes/ 
HD/ltmp/ssen/llvm/build/BuildTools/lib/System -I/Volumes/HD/ltmp/ssen/ 
llvm/include -I/Volumes/HD/ltmp/ssen/llvm/lib/System  -D_DEBUG - 
D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -g -fno- 
exceptions -fno-common -Woverloaded-virtual   -mmacosx-version- 
min=10.5 -Wall -W -Wno-unused-parameter -Wwrite-strings -arch ppc - 
arch ppc970 -isysroot /Developer/SDKs/MacOSX10.5.sdk -c /Volumes/HD/ 
ltmp/ssen/llvm/lib/System/Alarm.cpp -o /Volumes/HD/ltmp/ssen/llvm/ 
build/BuildTools/lib/System/Debug/Alarm.o


This is wrong for a variety of reasons:
1) It built them as PowerPC binaries, and I don't have Rosetta  
installed, so tblgen can't be run
2) --target was auto-inferred as i686-apple-darwin10.0.0, not the  
explicit --build=x86_64-apple-darwin10 I wanted
2) Because I used --enable-optimized, subsequent invocations of tblgen  
try to use BuildTools/Release/bin/tblgen. However the configure of  
BuildTools/ didn't forward --enable-optimized, so tblgen ended up in  
BuildTools/Debug/bin/tblgen

The attached patch fixes these issues, and allows BuiltTools/ for  
cross-hosted builds (in general, and Darwin in specific) to work much  
better.


Shantonu Sen
ssen at apple.com

Sent from my Mac Pro

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090902/465d2832/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cross-build.diff
Type: application/octet-stream
Size: 1281 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090902/465d2832/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090902/465d2832/attachment-0001.html>


More information about the llvm-commits mailing list