开发者

Load library failed, but symbol is available from referenced library

I'm trying to write a Python binding for a C++ library from a vendor we have. I'm moving along, but it's quite painful (partly because we don't have the source for the library).

Right now, gcc (4.4.4) complains about some Exception class it can't find:

Load library for "FOO_Sessions" failed, the system error message is "/home/djc/foo/lib/libFOO_Sessions.so: undefined symbol: _ZTIN3foo4some22SomeExceptionE"

However, I have found _ZTIN3foo4some22SomeExceptionE in libFOO_Elsewhere (using objdump -开发者_运维问答x), which can be found in the same /home/djc/foo/lib/ dir and is already referenced using the -l switch on the compiler invocation.

LD_DEBUG=all reports the following (thanks Erik for the suggestion):

/home/djc/foo/lib/libFOO_Sessions.so: error: symbol lookup error: undefined symbol: _ZTIN3foo4some22SomeExceptionE (fatal)

However, objdump -p reports this for libFOO_Sessions.so:

Dynamic Section:
  NEEDED               libFOO_Connections.so
  NEEDED               libFOO_Session_Base.so
  NEEDED               libstdc++.so.6
  NEEDED               libm.so.6
  NEEDED               libgcc_s.so.1
  NEEDED               libc.so.6
  SONAME               libFOO_Sessions.so

Shouldn't libFOO_Elsewhere (which contains _ZTIN3foo4some22SomeExceptionE) be in a NEEDED entry for libFOO_Sessions, as well?


Set LD_LIBRARY_PATH to /home/djc/foo/lib/ before running, or explicitly load the dependant library before libFOO_Sessions.so. man ld-linux explains how the dynamic linker will search.

EDIT:

Also, set LD_DEBUG=all before running in order to see how the dynamic linker searches.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜