views:

156

answers:

2

I'm trying to use a pre-compiled library provided as a .so file.

This file is dynamically linked against a few librairies :

$ ldd  /usr/local/test/lib/libtest.so
linux-gate.so.1 =>  (0xb770d000)
libstdc++-libc6.1-1.so.2 => not found
libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb75e1000)
libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb7499000)
/lib/ld-linux.so.2 (0xb770e000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb747c000)

Unfortunately, in Debian/squeeze, there is no libstdc++-libc6.1-1.so.* file. Only a libstdc++.so.* file provided by the libstdc++6 package.

I tried to link (using ln -s) libstdc++-libc6.1-1.so.2 to the libstdc++.so.6 file. It does not work, a batch of symbols seems to be lacking when I'm trying to ld my .o files with this lib.

/usr/local/test/lib/libtest.so: undefined reference to `__builtin_vec_delete'
/usr/local/test/lib/libtest.so: undefined reference to `istrstream::istrstream(int, char const *, int)'
/usr/local/test/lib/libtest.so: undefined reference to `__rtti_user'
/usr/local/test/lib/libtest.so: undefined reference to `__builtin_new'
/usr/local/test/lib/libtest.so: undefined reference to `istream::ignore(int, int)'

What would you do ? How may I find in which lib those symbols are exported ?

A: 

Try something along the lines of:

`find /lib -type f | xargs nm | less`

Then hunt for istrstream. This could be rather slow.

Marcelo Cantos
Thank you for the idea Marcelo, I think that it's the best way to find the symbols (although I searched /usr/lib and not /lib ;).Unfortunately, I'm unable to find the symbols I'm looking for.This is quite confusing.
madflo
A: 

Google says that you need libstdc++2.9-glibc2.1

http://linux.derkeiler.com/Mailing-Lists/Debian/2005-07/0755.html

Although it's from obsolete debian release and I'm not sure if it's such a good idea to install it.

Edit

Actually I tried it out of curiosity. It didn't do any harm and seem to coexist well with standard libstc++.so

debian:/home/dmitry# ll /usr/lib/\*stdc\*
-rw-r--r-- 1 root root 256240 2000-02-19 17:41 /usr/lib/libstdc++-2-libc6.1-1-2.9.0.so
lrwxrwxrwx 1 root root     30 2010-03-31 15:54 /usr/lib/libstdc++-libc6.1-1.so.2 -> libstdc++-2-libc6.1-1-2.9.0.so
lrwxrwxrwx 1 root root     19 2010-01-21 10:13 /usr/lib/libstdc++.so.6 -> libstdc++.so.6.0.13
-rw-r--r-- 1 root root 958628 2010-01-08 11:39 /usr/lib/libstdc++.so.6.0.13


wget http://archive.debian.org/debian/pool/main/e/egcs1.1/libstdc++2.9-glibc2.1_2.91.66-4_i386.deb

dpkg -i libstdc++2.9-glibc2.1_2.91.66-4_i386.deb

Dmitry Yudakov
Thank you for the answer. But I do agree: using an oldlib from an older and obsolete debian release is quite scary.
madflo
please see my update
Dmitry Yudakov
It's working here as well... good idea !
madflo