Question

On Linux, I've built two binaries, A and B, on the same machine. I take them to another machine with a slightly older libstdc++ installed. When I run ldd -v on binary A I get this:

libstdc++.so.6 (CXXABI_1.3) => /usr/lib64/libstdc++.so.6
libstdc++.so.6 (GLIBCXX_3.4) => /usr/lib64/libstdc++.so.6

When I run ldd -v on binary B I get this:

libstdc++.so.6 (CXXABI_1.3) => /usr/lib64/libstdc++.so.6
libstdc++.so.6 (GLIBCXX_3.4.15) => not found
libstdc++.so.6 (GLIBCXX_3.4) => /usr/lib64/libstdc++.so.6

Note the dependency for GLIBCXX_3.4.15 is not found. This makes sense because the installed libstdc++ only has support for up to GLIBCXX_3.4.10.

The question is: by what mechanism does ldd determine that binary B depends on GLIBCXX_3.4.15? More importantly, how do I determine what code is causing this dependency?

Was it helpful?

Solution

If you run nm on your executables, you'll see a large number of symbols, some of which are undefined (you can tell these as they are blank in the first column and have a U in the second column of nm's default output.)

Some of these symbols will have @@whatever suffixes on them. Those suffixes are the version dependencies of those symbols, and if you look for @@GLIBCXX_3.4.15 in your binary B, that should tell you which specific symbols are causing you to have that version dependency.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top