<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>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.</div><div><br></div><div>I tried:</div><div>$ ../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" </div><div>...</div><div><div>$ 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</div><div>...</div><div><br></div><div>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.</div><div><br></div><div>This ended up working poorly because the first thing the makefiles do is build BuildTools/ (including "tblgen") for the "build" architecture:</div><div><div><br></div><div>if [ ! -f BuildTools/Makefile ]; then \          /Volumes/HD/ltmp/ssen/llvm/autoconf/mkinstalldirs BuildTools; \</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>  cd BuildTools ; \</div><div><span class="Apple-tab-span" style="white-space:pre">     </span>  /Volumes/HD/ltmp/ssen/llvm/configure ; \</div><div><span class="Apple-tab-span" style="white-space:pre">      </span>  cd .. ; \</div><div><span class="Apple-tab-span" style="white-space:pre">     </span>fi; \</div><div>        (make -C BuildTools BUILD_DIRS_ONLY=1 ) || exit 1;</div><div>checking build system type... i686-apple-darwin10.0.0</div><div>checking host system type... <b>i686-apple-darwin10.0.0</b></div><div>checking target system type... i686-apple-darwin10.0.0</div><div>...</div><div>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 <b>-arch ppc -arch ppc970</b> -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/<b>Debug/Alarm.o</b></div><div><br></div></div><div><br></div><div>This is wrong for a variety of reasons:</div><div>1) It built them as PowerPC binaries, and I don't have Rosetta installed, so tblgen can't be run</div><div>2) --target was auto-inferred as i686-apple-darwin10.0.0, not the explicit --build=x86_64-apple-darwin10 I wanted</div><div>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</div><div><br></div><div>The attached patch fixes these issues, and allows BuiltTools/ for cross-hosted builds (in general, and Darwin in specific) to work much better.</div><div><br></div><div></div></div></body></html>