This is an old revision of the document!


Building the Boost libraries on Windows

XXX revisit

XXX wchar issue

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
$ 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.

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=/opt/boost --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=/opt/boost --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 /opt/boost/lib. You will also need

(No, Virginia, Boost does not have an install script)

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • diana/windows/building/boost.1263380640.txt.gz
  • Last modified: 2022-05-31 09:23:14
  • (external edit)