--enable-version-specific-runtime-libs configure option

lrtaylor@micron.com lrtaylor@micron.com
Thu Dec 9 17:31:00 GMT 2004


This isn't really an answer to your question, but g++ does not
automatically add the path to its libraries (e.g., libstdc++) to your
binary's run-path.  It may be smart enough to use the right library
during the linking process, but the path to it will not be automatically
embedded in the binary you're building.

Thanks,
Lyle


-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of Grumble
Sent: Thursday, December 09, 2004 9:01 AM
To: gcc-help@gcc.gnu.org
Subject: --enable-version-specific-runtime-libs configure option

Hello,

I'm afraid I don't quite understand what the 
--enable-version-specific-runtime-libs configure option is supposed to 
do. I've just built gcc-3.4.3 from source with the following options:

../gcc-3.4.3/configure --prefix=/local/gonzalez/gcc-3.4.3 
--program-suffix=-3.4.3 --with-arch=pentium4 --disable-nls 
--enable-version-specific-runtime-libs --enable-languages=c,c++
Thread model: posix
gcc version 3.4.3

My impression was that the option allowed several versions of GCC to 
coexist peacefully. If I have e.g. 4 different versions of GCC (3.4.0, 
3.4.1, 3.4.2, 3.4.3), each with its own libstdc++.so.6, I thought the 
driver would be smart enough to use the version specific library (as the

option name implies).

For example, the g++ driver could set LD_RUN_PATH, or add the 
appropriate -Wl,rpath command when calling the linker?

However...

$ cat toto.cxx
int main(void) { return 0; }

gonzalez@ulysse ~$ g++-3.4.3 -v toto.cxx
Reading specs from 
/local/gonzalez/gcc-3.4.3/lib/gcc/i686-pc-linux-gnu/3.4.3/specs
Configured with: ../gcc-3.4.3/configure 
--prefix=/local/gonzalez/gcc-3.4.3 --program-suffix=-3.4.3 
--with-arch=pentium4 --disable-nls 
--enable-version-specific-runtime-libs --enable-languages=c,c++
Thread model: posix
gcc version 3.4.3
  /local/gonzalez/gcc-3.4.3/libexec/gcc/i686-pc-linux-gnu/3.4.3/cc1plus 
-quiet -v -D_GNU_SOURCE toto.cxx -quiet -dumpbase toto.cxx 
-march=pentium4 -auxbase toto -version -o /tmp/ccR2CHod.s
ignoring nonexistent directory 
"/local/gonzalez/gcc-3.4.3/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../../i
686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
  /local/gonzalez/gcc-3.4.3/lib/gcc/i686-pc-linux-gnu/3.4.3/include/c++
 
/local/gonzalez/gcc-3.4.3/lib/gcc/i686-pc-linux-gnu/3.4.3/include/c++/i6
86-pc-linux-gnu
 
/local/gonzalez/gcc-3.4.3/lib/gcc/i686-pc-linux-gnu/3.4.3/include/c++/ba
ckward
  /usr/local/include
  /local/gonzalez/gcc-3.4.3/include
  /local/gonzalez/gcc-3.4.3/lib/gcc/i686-pc-linux-gnu/3.4.3/include
  /usr/include
End of search list.
GNU C++ version 3.4.3 (i686-pc-linux-gnu)
         compiled by GNU C version 3.4.3.
GGC heuristics: --param ggc-min-expand=98 --param
ggc-min-heapsize=129032
  as -V -Qy -o /tmp/ccyF5mDf.o /tmp/ccR2CHod.s
GNU assembler version 2.13.90.0.18 (i386-redhat-linux) using BFD version

2.13.90.0.18 20030206
  /local/gonzalez/gcc-3.4.3/libexec/gcc/i686-pc-linux-gnu/3.4.3/collect2

--eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 
/usr/lib/crt1.o /usr/lib/crti.o 
/local/gonzalez/gcc-3.4.3/lib/gcc/i686-pc-linux-gnu/3.4.3/crtbegin.o 
-L/local/gonzalez/gcc-3.4.3/lib/gcc/i686-pc-linux-gnu/3.4.3 
-L/local/gonzalez/gcc-3.4.3/lib/gcc/i686-pc-linux-gnu/3.4.3/../../.. 
/tmp/ccyF5mDf.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc 
/local/gonzalez/gcc-3.4.3/lib/gcc/i686-pc-linux-gnu/3.4.3/crtend.o 
/usr/lib/crtn.o

$ ldd a.out
         libstdc++.so.6 => not found
         libm.so.6 => /lib/i686/libm.so.6 (0x4002d000)
         libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x4004f000)
         libc.so.6 => /lib/i686/libc.so.6 (0x40058000)
         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

I must have missed something. How am I supposed to make multiple 
version-specific libstdc++.so.6 versions coexist. If I set 
LD_LIBRARY_PATH, it seems the same libstdc++.so.6 will be used every 
time instead of the version-specific one? I could set LD_RUN_PATH to the

proper path before I use each version, but I thought the g++ driver 
would do that?

-- 
Regards, Grumble



More information about the Gcc-help mailing list