diff options
author | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2010-11-23 21:35:28 +0100 |
---|---|---|
committer | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2010-11-23 21:35:28 +0100 |
commit | 630f2e270940e43850006f693af66d71c99a141d (patch) | |
tree | 5a88493b29cb17824172431a90746a50a39e9af9 | |
parent | 9a88bb84fb828797165501c283296dbc174ba3f0 (diff) | |
download | crosstool-ng-630f2e270940e43850006f693af66d71c99a141d.tar.gz crosstool-ng-630f2e270940e43850006f693af66d71c99a141d.tar.bz2 crosstool-ng-630f2e270940e43850006f693af66d71c99a141d.zip |
scripts/xldd: better find sysroot with old gcc
Only starting with 4.4 does gcc have a -print-sysroot option.
For 4.3 or before, we have to play some tricks:
- ask gcc where libc.so is,
(we expect it in ${sysroot}/usr/lib/libc.so)
- trim /usr/lib/libc.so from the result
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
(transplanted from aa2305c5b2a57fbcda9a1b5bb5fb3a476ac49a13)
-rwxr-xr-x | scripts/xldd.in | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/scripts/xldd.in b/scripts/xldd.in index 30077ad6..65cfa304 100755 --- a/scripts/xldd.in +++ b/scripts/xldd.in @@ -132,7 +132,15 @@ if [ ! -d "${root}" ]; then exit 1 fi -sysroot="$( "${gcc}" -print-sysroot )" +sysroot="$( "${gcc}" -print-sysroot 2>/dev/null )" +if [ -z "${sysroot}" ]; then + sysroot="$( "${gcc}" -print-file-name=libc.so 2>/dev/null \ + |sed -r -e 's:/usr/lib/libc.so$::;' \ + )" +fi +if [ -z "${sysroot}" ]; then + do_error "unable to find sysroot for \`${gcc}'" +fi do_report_needed_found() { local needed="${1}" |