shared libraries version

S

Stu

I have sample c++ program, which I am compiling (see steps below) on
Solaris 2.8, which uses the following version of g++.

/usr/local/bin/GNU/bin/g++ -c ./test.cpp -o test.o
/usr/local/bin/GNU/bin/g++ -g test.o -o test


/usr/local/bin/GNU/bin/g++ -v
Reading specs from /usr/local/bin/GNU/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/spe
cs
Configured with: /db_backups/gcc/srcdir/gcc-3.3.2/configure --prefix=/usr/local/
bin/GNU --disable-nls --enable-threads=posix --enable-languages=c,c++ --with-sys
tem-zlib
Thread model: posix
gcc version 3.3.2

An ldd on the executable repors that it needs verion 5 of libstdc++.so.

ldd ./test
libstdc++.so.5 => /usr/local/bin/GNU/lib/libstdc++.so.5
libm.so.1 => /usr/lib/libm.so.1
libgcc_s.so.1 => /usr/local/bin/GNU/lib/libgcc_s.so.1
libc.so.1 => /usr/lib/libc.so.1
libdl.so.1 => /usr/lib/libdl.so.1
/usr/platform/SUNW,Ultra-Enterprise/lib/libc_psr.so.1


Why is g++ referencing a specific version of a library instead of a generic
name? I would have hope do seen libstdc++.so as the requirement.

This way if there was a bug in libstdc++.so.5, version libstdc++.so.6 can be
installed, re-named to libstdc++.so and this would not require me to
re-build my executables.

Can you tell g++ to use libstdc++.so instead of libstdc++.so.5

Thanks in advance to all who answer
 
K

Karthik

Stu wrote:

Why is g++ referencing a specific version of a library instead of a generic
name? I would have hope do seen libstdc++.so as the requirement.

That is actually a symbolic link, that links to the latest version
of the library. Otherwise there is no way you can figure out which
version of stdc++ you are running . Anyway from the perspective of a
programmer, it is transparent and does not really matter.

Having said all these things, I feel this is off-topic for current
newsgroup CLC++ and hence following up with gnu.gcc.help which i feel is
the most appropriate for this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top