在我的应用程序中,我使用boost_python和python 3.5.2。全部由Ubuntu 14。
当我--with-shared在Ubuntu中从源代码构建Python 3.5.2时,得到了libpython3.so(7.6kB)和libpython3.5m.so(12MB)。我认为大的是真实的,小的可能是将呼叫转发到真实接口的东西。
由于boost_python可能假定客户端要针对python进行链接(https://svn.boost.org/trac/boost/ticket/2615),因此我与libpython3.so应用程序进行了链接。但是,当我运行它时,出现了无法解析的符号错误。
ldd -r myapp或ldd -r libboost_python.so都列出了所有未解析的python符号,可以在中找到nm -D libpython3.5m.so。
# ldd -r lib/libboost_python3.so
linux-vdso.so.1 => (0x00007ffe767fb000)
libstdc+.so.6 => /usr/lib/x86_64-linux-gnu/libstdc+.so.6 (0x00007f130a7a3000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f130a58d000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f130a1c8000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f1309ec2000)
/lib64/ld-linux-x86-64.so.2 (0x00007f130acf4000)
undefined symbol: PyExc_ImportError (lib/libboost_python3.so)
undefined symbol: PyProperty_Type (lib/libboost_python3.so)
undefined symbol: PyExc_StopIteration (lib/libboost_python3.so)
undefined symbol: PyBool_Type (lib/libboost_python3.so)
undefined symbol: PyExc_ValueError (lib/libboost_python3.so)
undefined symbol: PyList_Type (lib/libboost_python3.so)
undefined symbol: _Py_NotImplementedStruct …Run Code Online (Sandbox Code Playgroud)