Thursday, 23 April 2009

Missing symbol with mangled name when loading a library under Linux? How to track it down.

Suffering from a missing with a mangled name when loading a library under Linux? Here is how you can track down what is missing.

I had a library failing to load...

The error output reported a "symbol lookup error" for a mangled name like _Zkasdfkadf83 ... which didn't help me much. :)

To figure-out what this is:

cd [the folder with your libraries in]
grep Zkasdfkadf83 *.so

... This tells you the library that the symbol is referred to from.
Assume this is

Then, do this. Note: the first version shows you the mangled names, the second version shows you the UNMANGLED (i.e. human readable) names... Other than that, they are identical.

nm -B > sym.mangled
nm -C > sym.unmangled

Edit both files.
Look for the missing symbol in the first file, make note of the line number.
Go to that line in the second file. That shows you the unmangled-name corresponding to the mangled name. It should now be crystal-clear what the missing symbol is!



No comments: