This primarily affect Apple's gcc-5xxx but some of the issues are also in code which is part of FSF gcc-4.x.x. There may be some connection with PR 26814.
The symptom is that building i386 hosted or i386 target compilers on powerpc Darwin using the SDK fails. The problems would probably also affect attempts to build Darwin targetted compilers on Linux or other OS. I have following problems in the code with possible fixes: 1. This affects both Apple and FSF code. In gcc/configure.ac around line 1637 there is the following # Darwin crosses can use the host system's libraries and headers, # because of the fat library support. Of course, it must be the # same version of Darwin on both sides. Allow the user to # just say --target=foo-darwin without a version number to mean # "the version on this system". *-*-darwin*,*-*-darwin*) hostos=`echo $host | sed 's/.*-darwin/darwin/'` targetos=`echo $target | sed 's/.*-darwin/darwin/'` if test $hostos = $targetos -o $targetos = darwin ; then CROSS= SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)' with_headers=yes fi ;; This might have been correct when it was added in 2003 but is not true for all Darwin versions now. I suggest a specific test for fat libraries: # Darwin crosses can use the host system's libraries and headers, # because of the fat library support. Of course, it must be the # same version of Darwin on both sides. Allow the user to # just say --target=foo-darwin without a version number to mean # "the version on this system". *-*-darwin*,*-*-darwin*) hostos=`echo $host | sed 's/.*-darwin/darwin/'` targetos=`echo $target | sed 's/.*-darwin/darwin/'` if test x`lipo -info /usr/lib/libSystem.b.dylib | grep i386 | grep ppc` != x then if test $hostos = $targetos -o $targetos = darwin ; then CROSS= SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)' with_headers=yes fi fi ;; This could easily be extended if Steve decides to announce in August that the new XServe will use Itanic. (only kidding) 2. The remaining problems only affect Apple's build system. The configure invocations need a "--with-sysroot=/Developer/SDKs/MacOSX10.4u.sdk" option. This can be added to the CONFIGFLAGS definition in build-gcc around line 109 or see below. 3. The CFLAGS for many of the compiles needs to include "-isysroot=/Developer/SDKs/MacOSX10.4u.sdk". This can be added in the invocation of build-gcc by defining RC_NONARCH_CFLAGS but it would be better to deal with both 2 and 3 with a new envvar like BUILD_SDK. 4. The targetted build tools need to include ld. This can be achieved by adding ld to the list of tools in build-gcc around line 157. I have tested building Apple gcc-5341 with these mods and the build succeeds on both PowerPC and Intel Macs. Bill Northcott -- Summary: Cross compiles involving Darwin fail Product: gcc Version: 4.0.1 Status: UNCONFIRMED Severity: minor Priority: P3 Component: bootstrap AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: w dot northcott at unsw dot edu dot au GCC build triplet: powerpc-apple-darwin8 i386-apple-darwin8 GCC host triplet: powerpc-apple-darwin8 i386-apple-darwin8 GCC target triplet: powerpc-apple-darwin8 i386-apple-darwin8 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28026