Unable to build Boost.Python

二次信任 提交于 2019-12-01 08:29:06

问题


I am trying to build boost.python following this link. When I try to compile using ./b2 or ./bjam, I am getting errors like:

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

The error disappears when I added this line:

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

However, when compiling now, I get compile time errors of not being able to find header files. Just a small excerpt of the errors is:

 ...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

Need help on building this boost.python.


回答1:


The problem was not installing the python-devel or python-dev package corresponding to my python version.

In my case it was python2.6 so

sudo yum install python26-devel did the trick.




回答2:


I had a similar issue in my project and above would not help. I was cross-compiling python and boost, and the actual issue for me was duplication of the 'using python : ' in configuration (one existed in project-config.jam, following the bootstrap.sh/bat execution and I was trying to add another python config myself to a user-config.jam).

This solution was described in here: http://comments.gmane.org/gmane.comp.lib.boost.build/22088

and here: https://groups.google.com/forum/#!topic/boost-developers-archive/namMFSO_6Rg



来源:https://stackoverflow.com/questions/15136671/unable-to-build-boost-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!