Search code examples
pythonwindowsboostboost-pythonbjam

How do I get bjam to detect my Python installation on Windows?


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?


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 !