Building Boost from SVN trunk with Visual Studio 2008 (x86 & x64)

Welcome to the bleeding edge. Just switched to Visual Studio 2008, and you need Boost for your project? Then read on to see how you can build Boost from trunk with VC9 (actually, this also applies to VC8, and possibly even earlier versions, but I just tried with VC9).

Obtaining Boost

First of all, you need to get Boost. A detailed guide is available here, basically all you need to do is a SVN checkout of http://svn.boost.org/svn/boost/trunk. I got revision 42333, which I’ll use for the rest of this article.

Building Boost

Boost uses a custom build system, Boost.Build v2. Just take a look at the detailed manual to see how big the system is. Anyway, the first step is to build BJam, which is located in tools/build. Building is straightforward unless you have parentheses in your path - if so, read this earlier post describing the problem. Anyway, at the end, put the bjam.exe into the folder you just checked out from SVN (right to the index.html stuff!).

Running Boost.Build

For this example, I’ll assume you want to build the static-link libraries, x64, debug and release versions, and omit some libraries like Wave and Python to make things more interesting. Let’s start like most programming examples, by looking right at the command line needed:

bjam --build-dir=..\tmp\build --prefix=..\install-trunk
link=static,shared debug release address-model=64 threading=multi --toolset=msvc-9.0
--without-python --without-mpi install

Those options are also explained in the builtin features section of the manual.

You need to start this from the Visual C++ Command prompt — verify that you are running it by typing cl, it should give you something like:

Microsoft (R) C/C++ Optimizing Compiler Version 15.00.21022.08 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

Well, that’s it basically, now you need some patience, and you should get a perfect working version of Boost tailored at your needs with just the libraries you want. For the sake of completeness, here the command line I used to build Boost today:

bjam --build-dir=..\tmp\build --prefix=..\install-trunk link=static debug release
address-model=64 threading=multi --toolset=msvc-9.0 --without-python --without-mpi
--without-wave --without-thread install
^ Back to top