--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.


-----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


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?


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

gonzalez@ulysse ~$ g++-3.4.3 -v toto.cxx
Reading specs from 
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
-quiet -v -D_GNU_SOURCE toto.cxx -quiet -dumpbase toto.cxx 
-march=pentium4 -auxbase toto -version -o /tmp/ccR2CHod.s
ignoring nonexistent directory 
#include "..." search starts here:
#include <...> search starts here:
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
  as -V -Qy -o /tmp/ccyF5mDf.o /tmp/ccR2CHod.s
GNU assembler version (i386-redhat-linux) using BFD version 20030206

--eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 
/usr/lib/crt1.o /usr/lib/crti.o 
/tmp/ccyF5mDf.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc 

$ 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