Can I specify where g++looks for libs at runtime?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've built gcc 4.4.0 on SPARC having my gmp and mpfr in /usr/local/lib.

This is now I built it

LD_OPTIONS='-L/usr/local/lib -R/usr/local/lib'
export LD_OPTIONS
rm -rf gcc-4.4.0-built-with-gcc-3.4.3-ABI32d
mkdir gcc-4.4.0-built-with-gcc-3.4.3-ABI32d

cd gcc-4.4.0-built-with-gcc-3.4.3-ABI32d
/home/kirkby/gcc-4.4.0/configure 'CC=/usr/sfw/bin/gcc' \
--prefix=/usr/local/gcc-4.4.0-sun-linker \
--without-gnu-as \
--without-gnu-ld \
--with-as=/usr/ccs/bin/as  \
--with-ld=/usr/ccs/bin/ld \
--enable-languages=c,c++,fortran \
--with-mpfr-lib=/usr/local/lib \
--with-mpfr-include=/usr/local/include \
--with-gmp-include=/usr/local/include \
--with-gmp-lib=/usr/local/lib \
--with-libiconv-prefix=/usr/lib/iconv
/usr/sfw/bin/gmake -j 20


I find the C compiler works ok. But the C++ compiler can't find its own library files.

kirkby@t2:[~] $ gcc hello_world.c
kirkby@t2:[~] $ ./a.out
hello world
kirkby@t2:[~] $ g++ test.cpp
kirkby@t2:[~] $ ./a.out
ld.so.1: a.out: fatal: libstdc++.so.6: open failed: No such file or directory
Killed

I'm using the Sun linker, not the GNU one, so it's possible g++ is sending stuff to the linker to indicate where the libraries are, but the linker is ignoring them.

Ideally I'd like to send something to the Sun linker to day "look in /usr/local/gcc-4.4.0-sun-linker/lib for libraries too"

If I set LD_LIBRARY_PATH, then this will work.

kirkby@t2:[~] $ LD_LIBRARY_PATH=/usr/local/gcc-4.4.0-sun-linker/lib
kirkby@t2:[~] $ export LD_LIBRARY_PATH
kirkby@t2:[~] $ g++ test.cpp
kirkby@t2:[~] $ ./a.out
Hello World





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux