[C++-sig] Problem with importing shared library into Python
Anders Wallin
anders.e.e.wallin at gmail.com
Fri Nov 25 17:42:29 CET 2011
> Hope this can help better to understand (maybe) what is going on. Again, I
> follow the same procedure after installing the precompiled packages from
> Ubuntu using synaptic, and the same error. Hope that somebody can help.
FWIW with this CMakeLists.txt the example-code from the book compiles
and runs fine on my Ubuntu 11.10 system:
http://pastebin.com/YrWVEmxX
If I run make with "make VERBOSE=1" it gives the following output
(this might help if you don't want to use cmake...):
/usr/bin/c++ -Dphonebook_EXPORTS -fPIC -I/usr/include/python2.7
-o CMakeFiles/phonebook.dir/phonebook.o -c
/home/anders/Desktop/apibook-apibook-tip/11_Scripting/python/phonebook.cpp
/usr/bin/c++ -Dphonebook_EXPORTS -fPIC -I/usr/include/python2.7
-o CMakeFiles/phonebook.dir/phonebook_wrap.o -c
/home/anders/Desktop/apibook-apibook-tip/11_Scripting/python/phonebook_wrap.cpp
/usr/bin/c++ -fPIC -shared -Wl,-soname,phonebook.so -o
phonebook.so CMakeFiles/phonebook.dir/phonebook.o
CMakeFiles/phonebook.dir/phonebook_wrap.o -lboost_python
hth,
Anders
More information about the Cplusplus-sig
mailing list