views:

26

answers:

1

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

I get this linking error:

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

And I think my main.c is linking against libwebkit-1.0.la. So how can I find out if libwebkit-1.0.la has the symbol 'Browser_new'?

  CXXLD  libwebkit-1.0.la
  CCLD   Programs/GtkLauncher
+3  A: 

The problem could well be that you are using C and libwebkit has C++ symbols. The C++ symbol names will be mangled compared to what you may see in the include files.

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'

And then on the .so file you can use nm to show dynamic symbols:

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

If this is a C++ library, then you can use the -C flag to demangle the C++ function names.

$ nm -D -C libwebkit-1.0.so
rq
Thanks. But when i tried "nm -D libwebkit-1.0.so | grep Browser*" or "nm -D -C libwebkit-1.0.so | grep Browser*", I only see " U _ZN17Browser17testMsgEP14_WebKitWebView". But in my Browser.h, (a c++ class) I have more public and private methods than just 1 testMsg()).
michael
Is this your own Browser.h? If so, it sounds like you have the method in the .h, but no implementation.
rq