2

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.

boardrider
  • 5,882
  • 7
  • 49
  • 86
Chaitanya
  • 3,399
  • 6
  • 29
  • 47

2 Answers2

3

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.

Andy
  • 17,423
  • 9
  • 52
  • 69
Chaitanya
  • 3,399
  • 6
  • 29
  • 47
  • sudo yum install -y python27-devel, also tried python2.7 pthon-2.7 all gave the same message No package python-2.7-devel available. On my redhat 7. try to find it: yum search python | grep -i devel: http://stackoverflow.com/questions/23215535/how-to-install-python27-devel-on-centos-6-5 – Kemin Zhou Oct 21 '16 at 17:57
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

formiaczek
  • 385
  • 3
  • 7