gcc static libstdc++ for redistributing a library

0

I've run into a problem using OpenNao from Aldebaran's Gentoo (2.1.2.17) version. It uses gcc-4.5.3 and refuses to upgrade to a newer GCC version via emerge. However, both ROS and our framework relies on C++11, and has features which C++0x doesn't cover.

I've downloaded, built and installed in a home directory, gcc-4.8.4 successfully, and built our library, however, when I don't statically link with libstdc++, I get the usual error:

libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by...)

When I use the g++ flag: -static-libstdc++ I can verify via readelf -d that the binary which uses our library, does not any longer require libstdc++.so.6 which I have statically linked within our library.

Is this standard/defined behaviour? Is this in fact, the best way to freeze our library (which in turn is built both as static and shared) to gcc-4.8.4, until Aldebaran decides that it will support C++11?

[EDIT]

The shared library built, reads:

Dynamic section at offset 0x224bf8 contains 27 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libboost_system.so.1.55.0]
 0x00000001 (NEEDED)                     Shared library: [libstdc++.so.6]
 0x00000001 (NEEDED)                     Shared library: [libm.so.6]
 0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x00000001 (NEEDED)                     Shared library: [ld-linux.so.2]
 0x0000000e (SONAME)                     Library soname: [librapp.0.1.so]

Whereas the static-libstdc++ shared library reads:

Dynamic section at offset 0x2eb790 contains 26 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libboost_system.so.1.55.0]
 0x00000001 (NEEDED)                     Shared library: [libm.so.6]
 0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x00000001 (NEEDED)                     Shared library: [ld-linux.so.2]
 0x0000000e (SONAME)                     Library soname: [librapp.0.1.so]

So, to me, the problem linked with GLIBCXX_3.4.15 not being found, is related to libstdc++.so.6 which I am guessing ships with gcc-4.8.4 and has a different version/ABI from whatever libstdc++ came with OpenNao/gcc-4.5.3 In fact, the errors when linking a binary with our library, had to do with std::placeholders.

c++11
gcc
static-libraries
static-linking
asked on Stack Overflow Feb 17, 2015 by Ælex • edited Feb 17, 2015 by Ælex

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0