[nSLUG] Help? libstdc++ question/confusion

Dop Ganger nslug at fop.ns.ca
Wed Jan 14 08:10:25 AST 2009


On Wed, 14 Jan 2009, Mike Spencer wrote:

> So I copy the real lib over to the same dir on the new box (nudel),
> create the corresponding symlink:
>
>     nudel-root$  mount bogus:/
>
>     nudel-root$ pwd
>
>      /usr/i486-slackware-linux/lib
>
>    nudel-root$ cp \
>
>      /mnt/bogus/usr/i486-slackware-linux/lib/libstdc++-2-libc6.1-1-2.9.0.so .
>
>    nudel-root$ ln -s libstdc++-2-libc6.1-1-2.9.0.so  libstdc++-libc6.1-1.so.2
>
> and now the app in question segfaults.

Did you run ldconfig to reinitialise the library cache?

I think you might be better off using LD_PRELOAD rather than overwriting 
libraries.

> What can I do to fix this?

If ldconfig doesn't fix it, something like strace -f -s 500 netscape > 
/tmp/netscape.trace 2>&1 should give you a hint - /tmp/netscape.trace will 
be a trace of all system calls, signals, etc so might give you more 
information on just where it's segfaulting.

> I find this lib management stuff way more confusing than writing or
> even debugging C code.  I don't even know where to look for a lucid
> description of what the various libc* libraries do, how they differ,
> how they're systematically (?!) named and why there are so many that
> are just symlinks.  So I haven't doggedly documented, listed and
> researched this in tedious detail because I don't really know where to
> start.

libc is the C library. libc++ is the C++ library. There's also libm in the 
same family, which is the maths library. Naming appears to be up to the 
developer, leading to whimsy such as libiberty - during compilation the 
leading "lib" is stripped from the name, so it may be referenced to as 
"-liberty" (cue groan). The library itself is named by its full version, 
then it's symlinked to the major version it's compatible with (eg I have 
/lib/libbz2.so.1.0.4 which has libbz2.so.1 and libbz2.so.1.0 symlinked to 
it). Applications are compiled against major and minor versions, eg:

dop at tbox:/bin$ ldd bzip2
         linux-gate.so.1 =>  (0xb7f61000)
         libbz2.so.1.0 => /lib/libbz2.so.1.0 (0xb7f38000)
         libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7de9000)
         /lib/ld-linux.so.2 (0xb7f62000)
dop at tbox:/bin$

The other option is to set up a chroot with the libraries from the old 
system copied across en masse. I suspect at some point you're going to 
have to do this if you want to keep on running an older version of 
Netscape.

Cheers... Dop.



More information about the nSLUG mailing list