Bituki
Bituki

Reputation: 43

How can I find which part of my code is associated with an entry in the symbol table?

I am working on a project which needs to be executed in a Linux machine that has turned out not to have the GLIBCXX_3.4.20 version of a library, but the code needs it. Is there anyway to find which part of my code (C++) asks for this version?

I read the ELF file using objdump and realdef and I found which symbol needs it: _ZSt24__throw_out_of_rang@GLIBCXX_3.4.20 (4) but I don't know to which part of my code can be related.

Upvotes: 0

Views: 351

Answers (1)

Employed Russian
Employed Russian

Reputation: 213556

Your question is essentially a duplicate of this question.

Except in your case, it's not libc.so.6, but libstdc++.so that's giving you trouble.

Your problem is that you are compiling with new GCC, but are running on a machine with an old libstdc++.so.

You have a few options:

  • you can update target machine to have a new enough libstdc++.so
  • you can build using older version of GCC
  • you could use -static-libstdc++ flag to link required version of libstdc++ directly into your application. This will make a larger binary, but it will not be using libstdc++.so at all.

    Note that if you link against other shared libraries that do link against libstdc++.so, your binary may not run correctly on the target machine, so this solution should be used with caution.

Upvotes: 1

Related Questions