Building the Boost libraries on Windows

(using MinGW / MSYS)

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:

$ tar zxf boost-jam-3.1.17.tgz
$ cd boost-jam-3.1.17
$ sh ./build.sh
$ mkdir -p /usr/local/bin
$ cp bin.ntx86/bjam.exe /usr/local/bin
$ which bjam
/usr/local/bin/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/1.40.0/boost_1_40_0.tar.gz and extract them somewhere convenient:

$ tar zxvf boost/boost_1_40_0.tar.gz

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.

$ mkdir obj
$ bjam toolset=gcc --prefix=/usr/local --build-dir=obj

You will get a number of warnings about Boost.Python, Boost.Regex, Boost.Graph and Boost.MPI; you can safely ignore them, as metlibs doesn't use any of them. If it bothers you, you can disable the offending components:

$ bjam toolset=gcc --prefix=/usr/local --build-dir=obj --without-python \
--without-regex --without-graph --without-graph_parallel --without-mpi

If all goes well, you will find the libraries in the stage/lib subdirectory (under the source tree, not under obj; this is IMHO a mistake on bjam's part). You can copy them to wherever you need them to be, most likely /mingw/lib.