[Python] Undefined symbol in extension library with python 3
I compiled and installed boost 1.46.1 from source recently using:
$ ./bootstrap.sh --with-python-version=3.1
$ sudo ./bjam -j4 install
I then created the following trivial python extension:
#include
import test Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: ./test.so: undefined symbol: _ZN5boost6python6detail11init_moduleEPKcPFvvE
ldd confirms the missing symbol: $ ldd -r test.so linux-gate.so.1 => (0x00221000) libboost_python3.so.1.46.1 => /usr/local/lib/libboost_python3.so.1.46.1 (0x00a3d000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x0022b000) libm.so.6 => /lib/libm.so.6 (0x00960000) libc.so.6 => /lib/libc.so.6 (0x00316000) libutil.so.1 => /lib/libutil.so.1 (0x004b8000) libpthread.so.0 => /lib/libpthread.so.0 (0x00cf2000) libdl.so.2 => /lib/libdl.so.2 (0x00be4000) librt.so.1 => /lib/librt.so.1 (0x005d3000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00489000) /lib/ld-linux.so.2 (0x00fd5000) undefined symbol: PyExc_ImportError (/usr/local/lib/libboost_python3.so.1.46.1) undefined symbol: PyProperty_Type (/usr/local/lib/libboost_python3.so.1.46.1) ... snip ... *undefined symbol: _ZN5boost6python6detail11init_moduleEPKcPFvvE (./test.so) * undefined symbol: _Py_NoneStruct (./test.so) undefined symbol: PyLong_FromLong (./test.so) undefined symbol: PyLong_Type (./test.so) However nm confirms that the symbol exists in /usr/local/lib/libboost_python3.so.1.46.1: $ nm /usr/local/lib/libboost_python3.so.1.46.1 | c++filt | grep init_module 00031a00 T boost::python::detail::init_module(PyModuleDef&, void (*)()) I've tried running ldconfig to update the library cache, as well as compiling the extension with -lpython3.1, but no luck. Ideas appreciated, Vivek
At Wed, 27 Apr 2011 23:41:53 -0400, Vivek wrote:
I compiled and installed boost 1.46.1 from source recently using:
$ ./bootstrap.sh --with-python-version=3.1 $ sudo ./bjam -j4 install
I then created the following trivial python extension:
#include
struct mystruct { int i; };
BOOST_PYTHON_MODULE(test) { using namespace boost::python; class_<mystruct>("Mystruct") .def_readwrite("i", &mystruct::i) ; }
and compiled and ran it, but got an undefined symbol error:
Vivek, If this is still an issue for you, I'd appreciate it if you could file a bug in the Boost Trac at https://svn.boost.org/trac/boost Thanks, -- Dave Abrahams BoostPro Computing http://www.boostpro.com
participants (2)
-
Dave Abrahams
-
Vivek