Question

I am inheriting a project that uses bjam and boost-python to build some Python modules written in C++. The Jamroot previously contained:

constant PYTHON_ROOT : C:/Python26 ;
using python : 2.6 : $(PYTHON_ROOT) ;
use-project boost : C:/boost_1_40_0 ;

I have Python 2.7 installed instead, so I changed it to:

using python : 2.7 : C:/Python27 ;

I then ran bjam --toolset=msvc --with-python, which failed (after a very slow "...patience..." set of messages) because it couldn't find pyconfig.h or any of the Boost lib files. I changed it to:

using python : 2.7 : C:/Python27/python.exe : C:/Python27/include : C:/Python27/lib ;

to be explicit about the paths, which appears to have solved the pyconfig.h problem, although I was having issues with a 2.6 version of the above line even though I was specifying --python=2.7.

Now I get a bunch of Boost linker errors like LINK : fatal error LNK1104: cannot open file 'libboost_filesystem-vc90-mt-1_40.lib', even though they exist in C:/boost_1_40_0/stage/lib/.

Any ideas what configuration flags I'm missing?

Était-ce utile?

La solution

I think this is that "Boost.Python" within the "C:/boost_1_40_0" was built with Python2.6 But you want to use the "Boost.Python" of Python2.6 for nowadays Python2.7 binaries and libraries. This is a common error. You should rebuilt the Boost source package with Python2.7 !

Autres conseils

Depending on what is in your Jamroot file, you might need to add a couple of lines toward the beginning:

use-project boost : <Full path to your boost root directory> ;

This should tell your project to use boost found in the directory.

Also, in your project line, once you have the use-project boost command, you can add the library requirement for boost python in the requirements section of your project definition:

<library>/boost/python//boost_python

With these two lines added to my Jamroot file, I ceased to have the linking issues.

If you could post your Jamroot file, we could see if there is anything more specific needed.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top