我正在尝试针对我的自定义构建的python编译boost并获取" undefined reference"错误。详细信息如下:
1)我根据autodesk maya的要求构建了支持unicode = ucs4的python
./configure --prefix=/v/pkgs/python/dep/2.7.14 --enable-unicode=ucs4
make
make install
2)使用此命令构建提升
b2 -j 4 --layout=versioned --build-type=complete --debug-configuration stage
和配置文件./tools/build/src/user-config.jam使用我的python构建。
using python
: 2.7
: /v/pkgs/python/dep/2.7.14
;
这是b2输出的一部分,用于确认python选择成功:
notice: [python-cfg] Configuring python...
notice: [python-cfg] user-specified version: "2.7"
notice: [python-cfg] user-specified cmd-or-prefix: "/v/pkgs/python/dep/2.7.14"
notice: [python-cfg] Checking interpreter command "/v/pkgs/python/dep/2.7.14/bin/python2.7"...
notice: [python-cfg] running command '/v/pkgs/python/dep/2.7.14/bin/python2.7 -c "from sys import *; print('version=%d.%d\nplatform=%s\nprefix=%s\nexec_prefix=%s\nexecutable=%s' % (version_info[0],version_info[1],platform,prefix,exec_prefix,executable))" 2>&1'
notice: [python-cfg] ...requested configuration matched!
notice: [python-cfg] Details of this Python configuration:
notice: [python-cfg] interpreter command: "/v/pkgs/python/dep/2.7.14/bin/python2.7"
notice: [python-cfg] include path: "/v/pkgs/python/dep/2.7.14/include/python2.7"
notice: [python-cfg] library path: "/v/pkgs/python/dep/2.7.14/lib/python2.7/config" "/v/pkgs/python/dep/2.7.14/lib"
3)验证我尝试构建以下test.cpp
#include <Python.h>
#include <boost/python.hpp>
int main ()
{
Py_Initialize();
boost::python::object obj;
return 0;
}
使用此命令(更易于阅读的新行):
g++ -g -O2
-I/v/pkgs/python/dep/2.7.14/include/python2.7
-I/v/pkgs/boost/dep/1_61_0
-L/v/pkgs/boost/dep/1_61_0/stage/lib
-lboost_python-gcc48-mt-1_61
-L/v/pkgs/python/dep/2.7.14/lib
-lpython2.7
./test.cpp
我收到以下错误:
/v/pkgs/boost/dep/1_61_0/stage/lib/libboost_python-gcc48-mt-1_61.so: undefined reference to `PyUnicodeUCS4_FromEncodedObject'
/v/pkgs/boost/dep/1_61_0/stage/lib/libboost_python-gcc48-mt-1_61.so: undefined reference to `PyUnicodeUCS4_AsWideChar'
欢迎任何提示,谢谢!