------- Comment #8 from kkylheku at gmail dot com 2008-02-23 08:54 ------- I ended up doing the symlink trick because quite a bit of the sysroot material is needed to build everything, like libstdc++. It worked like a charm. And so now I have a compiler with search paths only in its own tree. Check this out:
$ toolchain2/mips64-linux/bin/mips64-linux-gcc -print-search-dirs install: /data/work/main-trunk/ZeugmaLinux/toolchain/mips64-linux/lib/gcc/mips64-linux/4.1.1/ programs: =/toolchain2/mips64-linux/bin/../libexec/gcc/mips64-linux/4.1.1/:/toolchain2/mips64-linux/bin/../libexec/gcc/:/toolchain2/mips64-linux/bin/../libexec/gcc/mips64-linux/4.1.1/:/toolchain2/mips64-linux/bin/../libexec/gcc/mips64-linux/4.1.1/:/toolchain2/mips64-linux/bin/../libexec/gcc/mips64-linux/:/toolchain2/mips64-linux/bin/../lib/gcc/mips64-linux/4.1.1/:/toolchain2/mips64-linux/bin/../lib/gcc/mips64-linux/:/toolchain2/mips64-linux/bin/../lib/gcc/mips64-linux/4.1.1/../../../../mips64-linux/bin/mips64-linux/4.1.1/:/toolchain2/mips64-linux/bin/../lib/gcc/mips64-linux/4.1.1/../../../../mips64-linux/bin/:/toolchain2/mips64-linux/bin/../lib/gcc/mips64-linux/4.1.1/../../../../mips64-linux/bin/mips64-linux/4.1.1/:/toolchain2/mips64-linux/bin/../lib/gcc/mips64-linux/4.1.1/../../../../mips64-linux/bin/ libraries: =/toolchain2/mips64-linux/bin/../lib/gcc/mips64-linux/4.1.1/:/toolchain2/mips64-linux/bin/../lib/gcc/:/toolchain2/mips64-linux/bin/../lib/gcc/mips64-linux/4.1.1/:/toolchain2/mips64-linux/bin/../lib/gcc/mips64-linux/4.1.1/../../../../mips64-linux/lib/mips64-linux/4.1.1/:/toolchain2/mips64-linux/bin/../lib/gcc/mips64-linux/4.1.1/../../../../mips64-linux/lib/:/toolchain2/mips64-linux/bin/../lib/gcc/mips64-linux/4.1.1/../../../../mips64-linux/lib/mips64-linux/4.1.1/:/toolchain2/mips64-linux/bin/../lib/gcc/mips64-linux/4.1.1/../../../../mips64-linux/lib/:/toolchain2/mips64-linux/bin/../mips64-linux/root/lib/mips64-linux/4.1.1/:/toolchain2/mips64-linux/bin/../mips64-linux/root/lib/:/toolchain2/mips64-linux/bin/../mips64-linux/root/usr/lib/mips64-linux/4.1.1/:/toolchain2/mips64-linux/bin/../mips64-linux/root/usr/lib/ The install: line reveals where I built the compiler: in the directory /data/work/main-trunk/... All other paths nicely begin with /toolchain2 where I copied the whole toolchain. (Actually I cheated; /toolchain2 it's a loopback NFS mount that points under /data/work, but that's beside the point). Before building GCC, I created a symlink: $GCC_BUILD_DIR/mips64-linux/root The "mips64-linux/root" is my relative path to the sysroot within a toolchain. So I just made this relative path work relative to the build directory, as a symlink to the real sysroot. Presto; xgcc nicely accepted this, and everything built. libgcc_s.so, libstdc++. What to do to close this bug? Someone should investigate the behavior of current gcc maybe. If you build a cross toolchain and relocate it, what is the output of -print-search-dirs? Are all the paths under the toolchain, or do some point back to the original build or install directory? Does a cross-compiling toolchain refer to build machine material in /usr/lib/gcc or /usr/libexec/gcc? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35300