C++ – How do I dump symbols in a .la file on Ubuntu Linux?

How do I dump symbols in a .la file on Ubuntu Linux?… here is a solution to the problem.

How do I dump symbols in a .la file on Ubuntu Linux?

How do I dump symbols in a .la file on Ubuntu Linux?

I get this link error:

main.c:(.text+0xbfb): undefined reference to `Browser_new'

And I think my main.c is linking libwebkit-1.0.la. So how do I know if libwebkit-1.0.la has the symbol “Browser_new”?

  CXXLD  libwebkit-1.0.la
  CCLD   Programs/GtkLauncher

Solution

The problem is most likely that you are using C and libwebkit has C++ notation. The C++ symbol name will be mangled compared to what you see in the include file.

Anyway, to answer the question: .la is a libtool library. Usually it points to a .so file:

$ grep dlname libwebkit-1.0.la
dlname='libwebkit-1.0.so'

Then on the .so file you can use nm to display dynamic symbols:

$ nm -D libwebkit-1.0.so
...

If this is a C++ library, then you can use -cflags to decompose C++ function names.

$ nm -D -C libwebkit-1.0.so

Related Problems and Solutions