From 8c45e50fad3a26eeb68f03182bf5996a32dc89e7 Mon Sep 17 00:00:00 2001 From: Stefan Fiedler Date: Thu, 23 Oct 2008 15:57:50 +0000 Subject: [PATCH] Stefan Fiedler: gcc: don't cross-build in stage 0 and 1; use cross-compiler in stage 2 diff -dur -x.svn package/base/gcc/gcc.conf ../ROCK/trunk/package/base/gcc/gcc.conf [2008093022431223678] (https://www.rocklinux.net/submaster) git-svn-id: http://www.rocklinux.org/svn/rock-linux/trunk@9095 c5f82cb5-29bc-0310-9cd0-bff59a50e3bc --- package/base/gcc/gcc.conf | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/package/base/gcc/gcc.conf b/package/base/gcc/gcc.conf index 8a76f18a6..deea1b42c 100644 --- a/package/base/gcc/gcc.conf +++ b/package/base/gcc/gcc.conf @@ -87,7 +87,15 @@ if [ "$pkg_gcc_cross" ] ; then fi elif [ $stagelevel -eq 0 ] ; then configprefix="" + # --build=${CLFS_HOST} added for gcc 4.3 in stages 0 and 1. This avoids + # cross-building the (cross-)compiler, which does not work here, and + # builds the compiler natively. Previous gcc versions (4.2.4 at least) + # seem to assume that build == host if --host is set but --build is not. + # gcc 4.3.1 configure warns about this with: + # WARNING: If you wanted to set the --build type, don't use --host. + # If a cross compiler is detected then cross compile mode will be used. confopt="--prefix=${CLFS}/$cross_tools \ + --build=${CLFS_HOST} \ --host=${CLFS_HOST} --target=${CLFS_TARGET} \$extraconfopt" var_append extraconfopt " " " \ --with-sysroot=${CLFS} --disable-nls --disable-shared \ @@ -102,6 +110,7 @@ elif [ $stagelevel -eq 0 ] ; then elif [ $stagelevel -eq 1 ] ; then configprefix="" confopt="--prefix=${CLFS}/$cross_tools \ + --build=${CLFS_HOST} \ --host=${CLFS_HOST} --target=${CLFS_TARGET} \$extraconfopt" var_append extraconfopt " " " \ --with-sysroot=${CLFS} --disable-nls --enable-shared \ @@ -118,6 +127,26 @@ elif [ $stagelevel -ge 2 ] ; then if [ $stagelevel -eq 2 ] ; then var_append extraconfopt " " "--enable-languages=\$languages \ --disable-libstdcxx-pch" + # Help configure find the right target tools, esp. important in + # native builds. Without this the tools installed on the build system + # might be used instead of the ones built in stage 0 and 1, and + # cause build errors. + export CC_FOR_TARGET=$pkg_gcc_target-gcc + export CXX_FOR_TARGET=$pkg_gcc_target-g++ + export GCC_FOR_TARGET=$pkg_gcc_target-gcc + export GCJ_FOR_TARGET=$pkg_gcc_target-gcj + export GFORTRAN_FOR_TARGET=$pkg_gcc_target-gfortran + export AS_FOR_TARGET=$pkg_gcc_target-as + export AR_FOR_TARGET=$pkg_gcc_target-ar + export LD_FOR_TARGET=$pkg_gcc_target-ld + export NM_FOR_TARGET=$pkg_gcc_target-nm + export OBJDUMP_FOR_TARGET=$pkg_gcc_target-objdump + export RANLIB_FOR_TARGET=$pkg_gcc_target-ranlib + export STRIP_FOR_TARGET=$pkg_gcc_target-strip + # The configure option + # var_append extraconfopt " " "--with-build-time-tools=$root/$cross_tools/$pkg_gcc_target/bin" + # does not work because $builddir/$cross_tools/$pkg_gcc_target/bin/gcc can't find cc1 + # (but $builddir/$cross_tools/bin/$pkg_gcc_target-gcc can). else var_append extraconfopt ' ' '--enable-languages=$languages' x="ROCKCFG_PKG_GCC${pkg_gcc_version}_BOOTSTRAP" @@ -363,6 +392,15 @@ custmain () { } > $root/etc/profile.d/gxx fi + # The location of libgcc_s.so{,.1} has changed in gcc 4.3, move to old location. + if [ $pkg_gcc_version -ge 43 ]; then + for x in $root/$prefix/lib/${gcc_lib_dir}/../lib/libgcc_s.so.* ; do + [ -e "$x" ] && mv -v "$x" $root/$prefix/lib/${gcc_lib_dir}/ + done + [ -e $root/$prefix/lib/${gcc_lib_dir}/../lib ] && \ + rmdir -v --ignore-fail-on-non-empty $root/$prefix/lib/${gcc_lib_dir}/../lib + fi + # Create symlinks for runtime libraries so they can be found by # the dynamic loader and force rebuilding of the wrapper links #