I write this as simplified tutorial how to build boost on windows using tdm-gcc. Boost seems to be very popular and wide known library but unfortenately build instructions are outdated or missing some details. This instruction is only for gcc toolchain on windows.

Example use “C:/boost_1_66_0” as boost root directory. I used git bash for windows.

First thing that need to be done is to build boost.build system. Open command line and change directory to “C:/boost_1_66_0/tools/build” then run:

./bootstrap.bat gcc

It will produce two binaries in the folder: b2.exe and bjam.exe, according the boost documentation those files are equivalent, and produce the same output.

Next step – installation of boost.build – can be omitted, but I will demonstrate it.

./b2 install --toolset=gcc --prefix=C:/boost_1_66_0/boost_build_engine

That command install the boost.build to the boost_build_engine subdirectory of boost root directory. Directory boost_build_engine/bin should be added to the path.

Now we can build boost library itself. CD to boost root directory.

b2 -j4 --debug-building --build-dir=C:/cpp/boost_bin_static address-model=64 toolset=gcc threading=multi architecture=x86 variant=release,debug link=static

This informations are gathered from:

Leave a Reply