Fix building x86_64 on x86_64 (and hopefully all other *64 archs on the same *64):
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jul 27 16:35:37 2008 +0000 (2008-07-27)
changeset 740d26d8cc7c460
parent 738 e8c68d0d1a0c
child 741 6c5084999910
Fix building x86_64 on x86_64 (and hopefully all other *64 archs on the same *64):
- symlink all lib64/ dirs to the corresponding lib/ dir
Also, prevent gcc from installing some of its target libs outside of the sys-root, in the first place.
Thanks to Laurent DUFRECHOU for reporting the bug and testing the fix.

/trunk/scripts/build/cc_gcc.sh | 26 0 26 0 --------------------------
/trunk/scripts/crosstool.sh | 14 14 0 0 ++++++++++++++
2 files changed, 14 insertions(+), 26 deletions(-)
scripts/build/cc_gcc.sh
scripts/crosstool.sh
     1.1 --- a/scripts/build/cc_gcc.sh	Sun Jul 27 14:25:19 2008 +0000
     1.2 +++ b/scripts/build/cc_gcc.sh	Sun Jul 27 16:35:37 2008 +0000
     1.3 @@ -281,26 +281,6 @@
     1.4          CT_DoExecLog ALL make ${PARALLELMFLAGS} all-build-libiberty
     1.5      fi
     1.6  
     1.7 -    # Idea from <cort.dougan at gmail.com>:
     1.8 -    # Fix lib/lib64 confusion for GCC 3.3.3 on PowerPC64 and x86_64.
     1.9 -    # GCC 3.4.0 and up don't suffer from this confusion, and don't need this
    1.10 -    # kludge.
    1.11 -    # FIXME: we should patch gcc's source rather than uglify crosstool.sh.
    1.12 -    # FIXME: is this needed for gcc-3.3.[56]?
    1.13 -    case "${CT_CC_FILE}" in
    1.14 -      gcc-3.3.[34])
    1.15 -        case "${CT_TARGET}" in
    1.16 -          powerpc64-unknown-linux-gnu|x86_64-unknown-linux-gnu)
    1.17 -            for d in $(find "${CT_SYSROOT_DIR}" -name lib -type d -empty); do
    1.18 -              if [ -d $(dirname "${d}")/lib64 ] ; then
    1.19 -                rm -rf "${d}"
    1.20 -                ln -s $(dirname "${d}")/lib64 "${d}"
    1.21 -              fi
    1.22 -            done ;;
    1.23 -          *) ;;
    1.24 -        esac ;;
    1.25 -    esac
    1.26 -
    1.27      CT_DoLog EXTRA "Building final compiler"
    1.28      CT_DoExecLog ALL make ${PARALLELMFLAGS} all
    1.29  
    1.30 @@ -311,11 +291,5 @@
    1.31      # to call the C compiler with the same, somewhat canonical name.
    1.32      ln -sv "${CT_PREFIX_DIR}/bin/${CT_TARGET}"-{g,}cc 2>&1 |CT_DoLog ALL
    1.33  
    1.34 -    # gcc installs stuff in prefix/target/lib, when it would make better sense
    1.35 -    # to install that into sysroot/usr/lib
    1.36 -    CT_DoLog EXTRA "Moving improperly installed gcc libs to sysroot"
    1.37 -    ( cd "${CT_PREFIX_DIR}/${CT_TARGET}/lib"; tar cf - . ) | ( cd "${CT_SYSROOT_DIR}/usr/lib"; tar xfv - ) |CT_DoLog ALL
    1.38 -    rm -rf "${CT_PREFIX_DIR}/${CT_TARGET}/lib"
    1.39 -
    1.40      CT_EndStep
    1.41  }
     2.1 --- a/scripts/crosstool.sh	Sun Jul 27 14:25:19 2008 +0000
     2.2 +++ b/scripts/crosstool.sh	Sun Jul 27 16:35:37 2008 +0000
     2.3 @@ -350,6 +350,20 @@
     2.4      mkdir -p "${CT_SYSROOT_DIR}/lib"
     2.5      mkdir -p "${CT_SYSROOT_DIR}/usr/lib"
     2.6  
     2.7 +    # Prevent gcc from installing its libraries outside of the sys-root
     2.8 +    ln -sf "sys-root/lib" "${CT_PREFIX_DIR}/${CT_TARGET}/lib"
     2.9 +
    2.10 +    # Now, in case we're 64 bits, just have lib64/ be a symlink to lib/
    2.11 +    # so as to have all libraries in the same directory (we can do that
    2.12 +    # because we are *not* multilib).
    2.13 +    case "${CT_TARGET}" in
    2.14 +        powerpc64*|ppc64*|x86_64*)
    2.15 +            ln -sf "lib" "${CT_SYSROOT_DIR}/lib64"
    2.16 +            ln -sf "lib" "${CT_SYSROOT_DIR}/usr/lib64"
    2.17 +            ln -sf "sys-root/lib" "${CT_PREFIX_DIR}/${CT_TARGET}/lib64"
    2.18 +            ;;
    2.19 +    esac
    2.20 +
    2.21      # Canadian-cross are really picky on the way they are built. Tweak the values.
    2.22      CT_UNIQ_BUILD=$(echo "${CT_BUILD}" |sed -r -e 's/-/-build_/')
    2.23      if [ "${CT_CANADIAN}" = "y" ]; then