我正在尝试在此link之后构建boost.python
。
当我尝试使用./b2
或./bjam
进行编译时,我收到的错误如下:
error: No best alternative for /python_for_extensions
next alternative: required properties: <python>2.6 <target-os>linux
matched
next alternative: required properties: <python>2.6 <target-os>linux
matched
添加此行时错误消失:
using python : 2.6 : /usr/bin/python2.6 : /usr/include/python2.6 : /usr/lib/python2.6 : <python-debugging>on ;
in
/home/kchaitanya/boost/boost_1_50_0/tools/build/v2/user-config.jam
然而,在编译时,我得到无法找到头文件的编译时错误。只是一小段错误摘录:
...patience...
...patience...
...found 1548 targets...
...updating 62 targets...
gcc.compile.c++ bin.v2/libs/python/build/gcc-4.1.2/release/link-static/threading multi/numeric.o
In file included from ./boost/python/detail/prefix.hpp:13,
from ./boost/python/numeric.hpp:8,
from libs/python/src/numeric.cpp:6:
./boost/python/detail/wrap_python.hpp:50:23: error: pyconfig.h: No such file or directory
./boost/python/detail/wrap_python.hpp:75:24: error: patchlevel.h: No such file or directory
./boost/python/detail/wrap_python.hpp:78:2: error: #error Python 2.2 or higher is required for
./boost/python/detail/wrap_python.hpp:142:21: error: Python.h: No such file or directory
./boost/python/instance_holder.hpp:34: error: ‘PyObject’ has not been declared
./boost/python/instance_holder.hpp:41: error: expected ‘;’ before ‘(’ token
./boost/python/instance_holder.hpp:45: error: ‘PyObject’ has not been declared
./boost/python/detail/wrapper_base.hpp:21: error: expected initializer before ‘*’ token
./boost/python/detail/wrapper_base.hpp:23: error: expected initializer before ‘*’ token
需要帮助构建此boost.python。
答案 0 :(得分:3)
问题是没有安装与我的python版本对应的python-devel
或python-dev
包。
在我的情况下,它是python2.6所以
sudo yum install python26-devel
成功了。
答案 1 :(得分:2)
我的项目中有类似的问题,上面也无济于事。我正在交叉编译python和boost,对我来说实际问题是使用python重复:&#39;在配置中(一个存在于project-config.jam中,在bootstrap.sh/bat执行之后,我试图将自己的另一个python配置添加到user-config.jam)。
这个解决方案在这里描述: http://comments.gmane.org/gmane.comp.lib.boost.build/22088
在这里: https://groups.google.com/forum/#!topic/boost-developers-archive/namMFSO_6Rg