Building the Boost libraries on Windows

Boost jam

This utility is used to compile the Boost libraries.

Get the source tarball from http://downloads.sourceforge.net/project/boost/boost-jam/3.1.17/boost-jam-3.1.17.tgz; once you have it, it's a simple matter of running the build script (which will automatically detect MinGW) and installing the resulting executable:

$ sh ./build.sh
$ cp bin.ntx86/bjam.exe /mingw/bin
$ which bjam
/mingw/bjam.exe
$ bjam -v
Boost.Jam Version 3.1.17. OS=NT.
Copyright 1993-2002 Christopher Seiwald and Perforce Software, Inc.
Copyright 2001 David Turner.
Copyright 2001-2004 David Abrahams.
Copyright 2002-2008 Rene Rivera.
Copyright 2003-2008 Vladimir Prus.

Main libraries

Download the main Boost libraries from http://downloads.sourceforge.net/project/boost/boost and extract them somewhere convenient.

Let's see what we've got:

$ bjam --show-libraries
The following libraries require building:
- date_time
- filesystem
- graph
- graph_parallel
- iostreams
- math
- mpi
- program_options
- python
- regex
- serialization
- signals
- system
- test
- thread
- wave

Jam will detect that you're running Windows and (rather then check what's available) assume that you want to use the MSVC toolchain; you have to force it to use gcc instead. You should also use a separate build directory; it will make it easier to clean up if you make a mistake and need to start over.

In principle, you could use the following command to build Boost:

$ bjam toolset=gcc --prefix=/opt/boost --build-dir=obj --layout=system stage

If you do, though, you will get warnings about several components due to missing compiler features (e.g. wchar for Boost.Serialization) and / or third-party components (e.g. Python for Boost.Python).

$ bjam toolset=gcc variant=release link=shared threading=multi \
--prefix=/c/met.no --build-dir=obj --layout=tagged \
--without-graph --without-graph_parallel --without-mpi \
--without-python --without-serialization \
stage

To install the result, run the exact same command, but with install instead of stage:

$ bjam toolset=gcc variant=release link=shared threading=multi \
--prefix=/c/met.no --build-dir=obj --layout=tagged \
--without-graph --without-graph_parallel --without-mpi \
--without-python --without-serialization \
install

XXX can't get static linking to work