Symbol lookup error when running a binary on a different Linux host, while all the shared libraries are successfully resolved

  c++, linux, shared-libraries, undefined-symbol

I encountered a very frustrating problem. I compiled a C++ program on one Linux host, and it can run successfully even though when I run "nm -D" on it I see

U _ZTINSt3_V214error_categoryE

(And I know that this undefined symbol is from one of the shared libraries that it links to, since when I run "nm -D" on that shared library I can see the same line)

Then I copied the binary and all the shared libraries that it requires (other than the system libraries) to a different Linux host (with exactly the same distribution and version), I put all the shared libraries in exactly the same directories, and set LD_LIBRARY_PATH accordingly (which is the same on both hosts), and then I used "ldd" to verify that they are all resolved correctly. In fact, the "ldd" outputs look identical except for the addresses.

And when I run the binary on the second Linux host, I got

binary_name: symbol lookup error: shared_library_name: undefined symbol: _ZTINSt3_V214error_categoryE

So I have two questions:

First, how did the binary work on the first Linux host when "nm -D" shows this symbol to be undefined?
And second, why it fails to work on the second Linux host which is, as far as I know, identical to the first one?

Any help would be greatly appreciated, thanks!

Source: Windows Questions C++

LEAVE A COMMENT