How can a self contained gcc and g++ be created such that behaviour between gcc and g++ is consistent without having to set setting LD_LIBRARY_PATH?
Test system: Linux 2.4.32 #1 SMP Tue Aug 8 10:17:37 PDT 2006 i686 i686 i386 GNU/Linux g++ breaks on libstdc++.so.* gcc appears to be fine. Why am I forced to set the library path with g++ but not gcc? This is inconsistent and confusing. Why don't the resulting binaries look in --with-local-prefix or --prefix library paths at runtime? gcc created like this, (/usr/foo empty at start): /usr/foo/src/gcc-3.4.6/configure --prefix=/usr/foo --with-local-prefix=/usr/foo --program-suffix=-3.4.6 --enable-languages=c,c++ example: $ /usr/foo/bin/gcc-3.4.6 -v Reading specs from /usr/foo/lib/gcc/i686-pc-linux-gnu/3.4.6/specs Configured with: /usr/foo/src/gcc-3.4.6/configure --prefix=/usr/foo --with-local-prefix=/usr/foo --program-suffix=-3.4.6 --enable-languages=c,c++ Thread model: posix gcc version 3.4.6 $ /usr/foo/bin/g++-3.4.6 -v Reading specs from /usr/foo/lib/gcc/i686-pc-linux-gnu/3.4.6/specs Configured with: /usr/foo/src/gcc-3.4.6/configure --prefix=/usr/foo --with-local-prefix=/usr/foo --program-suffix=-3.4.6 --enable-languages=c,c++ Thread model: posix gcc version 3.4.6 $ /usr/foo/bin/gcc-3.4.6 hello.c $ ./a.out hello, world $ ldd a.out libc.so.6 => /lib/i686/libc.so.6 (0x42000000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000) $ /usr/foo/bin/g++-3.4.6 hello.cc $ ./a.out ./a.out: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory $ ldd a.out libstdc++.so.6 => not found libm.so.6 => /lib/i686/libm.so.6 (0x40031000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x40053000) libc.so.6 => /lib/i686/libc.so.6 (0x42000000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000) $ export LD_LIBRARY_PATH=/usr/foo/lib $ ldd ./a.out libstdc++.so.6 => /usr/foo/lib/libstdc++.so.6 (0x40013000) libm.so.6 => /lib/i686/libm.so.6 (0x40107000) libgcc_s.so.1 => /usr/foo/lib/libgcc_s.so.1 (0x40129000) libc.so.6 => /lib/i686/libc.so.6 (0x42000000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000) $ ./a.out hello, world Thanks, -Nathan