[C++-sig] Problem with importing shared library into Python

Edgardo C. edxxgardo at gmail.com
Fri Nov 25 12:54:13 CET 2011


Hello everybody,

I am having problems with importing a .so shared library I just compiled
following the example giving in the book:
API Design for C++ : www.apibook.com (Chapter 11)

I downloaded the Boost library and I compiled it (fullw) into a
subdirectory called /compilation, where I get the /include and /lib
directories. No error during the compilation (Ubuntu 11.10).
Then I downloaded the code from the book examples and I compiled it without
errors and I get the phonebook.so in the same directory as where I launch
python interpreter, but the import in python trigger this error:


ImportError: /home/pablo/phonebook/phonebook.so: undefined symbol:
_ZN5boost6python6detail11init_moduleEPKcPFvvE

what I think is because python does not find the library.

I try to play around with the LD_LIBRARY_PATH variable, ldconfig, I copied
the phonebook.so library into /usr/lib and /usr/local/lib, and nothing ...
I get the same error.

Can anybody explain me what is the problem? thanks a lot in advance,

N.B: the version of python used during the boost compilation and .cpp
compilation are the same, 2.7
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20111125/9caede4c/attachment.html>


More information about the Cplusplus-sig mailing list