GLIBCXX versions
Solution 1
Use readelf -a
and objdump -x
to inspect ELF files in preference to strings
.
Actually, all the GLIBCXX_* versions don't apply to the entire library, but to each symbol (symbol versioning, see DSO-howto). So you can have e.g: std::char_traits<wchar_t>::eq@@GLIBCXX_3.4.5
and std::ios_base::Init::~Init()@@GLIBCXX_3.4
on the same library file.
The fact that your program needs GLIBCXX_3.4.9 probably means that it has been linked against a symbol that has been introduced/has changed semantics on GLIBCXX_3.4.9.
Solution 2
- That the the library version that is installed on your system. You could manually build the glibc version 3.4.14 and link to it
- That depends. Maybe the later version fixed some issues. The users of your program would have to link against the version that your program requires
- The memory usage is higher
- Yes, pass proper parameter to the linker. If you need specific version of the library, then it is best to download it, and build it manually, and link to it.
EDIT
I just remembered that statically linked libraries increase the memory usage.
Comments
-
peoro almost 4 years
If I compile a C++ program on my machine, and run it on another one (with older software) I get:
/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found
.In fact on my system glibc is newer (I got gcc-libs 4.5.1: libstdc++.so.6.0.14) and
strings /usr/lib/libstdc++.so.6 | grep GLIBCXX
prints fromGLIBCXX_3.4
toGLIBCXX_3.4.14
. On the other system, instead, it only prints up toGLIBCXX_3.4.8
(I got libstdc++.so.6.0.8).So I've got a few questions:
Why my linker links C++ binaries against libstdc++ version
GLIBCXX_3.4.9
instead ofGLIBCXX_3.4.14
?If I complied my binary against libstdc++ version
GLIBCXX_3.4
I guess it would run almost on everywhere. Would that imply any sort of issues? (eg: would it use older -and thus worse- algorithm implementations?)If instead I statically link my program against my libstdc++ I guess it will run everywhere; the binary will be a lot bigger (~1MB) of course, any other pros/cons?
Can I force the linker to link my binary against a given version of libstdc++?
-
BЈовић over 13 years@Ignacio Vazquez-Abrams So, I got 2 out of 4. For 1), I guess it is missing dependencies for the glibc. If 3 is not correct, I guess I live in ignorance. So, how to correct those two?
-
Ignacio Vazquez-Abrams over 13 years1 I'm not certain of, but the library does have
GLIBCXX_3.4.14
in it, it's just not using it for some reason. For 3, consider the implications of not being able to update the library. -
BЈовић over 13 yearsIf you statically link the library, then you do not care to update it. All symbols are there. Updating the application is worse, because it is going to be larger
-
peoro over 13 years1. I've got only libstdc++.so.6.0.14 installed. Besides ninjalj's answer is giving a different explaination... 4. What would be the proper parameter?
-
BЈовић over 13 yearsSame as linking other static libraries - pass it as a parameter when linking. network-theory.co.uk/docs/gccintro/gccintro_25.html
-
jcoffland over 11 yearsAlso c++filt can be helpful if yo uhave C++ code. For example: readelf -aW <file> | c++filt