Building the Boost libraries on Windows

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.

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
$ cp LICENSE_1_0.txt /c/met.no/copyright/boost.txt

XXX can't get static linking to work

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.txt
  • Last modified: 2022-05-31 09:29:31
  • (external edit)