Notes on updating boost/python for Windows

grab boost sources from http://parrot.cs.wisc.edu/externals/boost_1_54_0.tar.gz

I build them in d:\scratch\condor\update_externals

cd /d: d:\scratch\condor\update_externals
wget http://parrot.cs.wisc.edu/externals/boost_1_54_0.tar.gz
7z x boost_1_54_0.tar.gz

find the .tar file that was created 3 directories down... (sigh) unpack it, and move the resulting directory up to \scratch\condor\update_externals then cd into it and install run the visual studio 2012 environment setup script. and then the boost bootstrap.bat script to build bjam

"%VS110COMNTOOLS%\vsvars32.bat"
cd /d d:\scratch\condor\update_externals\boost_1_54_0
bootstrap.bat

Add the following to the project-config.jam file after the "using msvc" line. (if building x64 you don't want to do this)

add to project-config.jam
using msvc ;

using python : 2.7 : c:\\tools\\Python27x32\\python.exe
    : c:\\tools\\Python27x32\\include ;

From the same directory that has bootstrap.bat, The following commands are used to build boost/python libraries. (note that for x64 builds the commands are a bit different, see below)

bjam --with-python python-debugging=off threading=multi variant=release link=shared stage
bjam --with-python python-debugging=off threading=multi variant=debug link=shared stage
bjam --with-python python-debugging=off threading=multi variant=release link=static stage
bjam --with-python python-debugging=off threading=multi variant=debug link=static stage

The tarball also needs boost-test, so run these as well

bjam --with-test threading=multi variant=release link=static stage
bjam --with-test threading=multi variant=debug link=static stage

boost puts the resulting libs into the stage\lib directory

  dir stage\lib

   Directory of d:\scratch\condor\update_externals\boost_1_54_0\stage\lib

  04/06/2016  01:18 PM              .
  04/06/2016  01:18 PM              ..
  04/06/2016  10:37 AM           216,064 boost_python-vc110-mt-1_54.dll
  04/06/2016  10:37 AM           190,156 boost_python-vc110-mt-1_54.lib
  04/06/2016  10:36 AM           484,864 boost_python-vc110-mt-gd-1_54.dll
  04/06/2016  10:36 AM           191,452 boost_python-vc110-mt-gd-1_54.lib
  04/06/2016  01:17 PM         6,621,436 libboost_python-vc110-mt-1_54.lib
  04/06/2016  01:18 PM        26,743,942 libboost_python-vc110-mt-gd-1_54.lib
               6 File(s)     34,447,914 bytes

boost 1.54 will build 32 bit libraries by default, regardless of what compiler is in your path. to build 64 bit boost libaries, add 'address-model=64' to the bjam command lines above before the 'stage' argument like this:

bjam --with-python python-debugging=off threading=multi variant=release link=shared address-model=64 stage
bjam --with-python python-debugging=off threading=multi variant=debug link=shared address-model=64 stage
bjam --with-python python-debugging=off threading=multi variant=release link=static address-model=64 stage
bjam --with-python python-debugging=off threading=multi variant=debug link=static address-model=64 stage
bjam --with-test threading=multi variant=release link=static address-model=64 stage
bjam --with-test threading=multi variant=debug link=static address-model=64 stage

If you wish to build against a debug version of the python library, you need to first build python_d.exe and then add lines to your project-config.jam file to tell bjam where to find it, something like this.

add to project-config.jam
  using python : 2.7 : D:\\scratch\\pybuild\\PCBuild\\python_d.exe
    : D:\\scratch\\pybuild\\Include D:\\scratch\\pybuild\\PC
    : D:\\scratch\\pybuild\\PCBuild

(Note: if you build using only VS9, rather than both VS9 and VS11, then some of the results are in PC\VS9.0 rather than in PCBuild, so your actual settings might be more like this...)

add to project-config.jam when building using vs9
  using python : 2.7 : D:\\scratch\\pybuild\\PC\\VS9.0\\python_d.exe
    : D:\\scratch\\pybuild\\Include D:\\scratch\\pybuild\\PC
    : D:\\scratch\\pybuild\\PC\\VS9.0