Wednesday, February 16, 2011

boost, in vista using mingw and cmd.exe

Gezz.. what a pain... Getting boost to build in mingw is a bit of a mess. The docs dont "officially" cover it, but it does work once you patch together all the various missing pieces. Here is how:

Mingw version: 4.5
Boost Version: 1.45
OS: Vista.

First Download the version from
Dont download the build version of bjam it wont work. You need to build it.

Build bjam:

Note that I use the directory c:\tools as my install area for all programs that need to avoid the windows UAE etc idiocy.. Transfer the unziped/untared files into the desired location and then build the bjam.exe

In cmd.exe execute:
cd C:\tools\boost_1_45_0\tools\build\v2\engine\src
build.bat mingw
Once built copy C:\tools\boost_1_45_0\tools\build\v2\engine\src\bin.ntx86\bjam.exe into C:\tools\MinGW\bin (makes it easy later, since you likely have it in your %PATH% var already.)

Build the boost libs In cmd.exe execute:
bjam toolset=gcc --build-type=complete stage

Wait copious amounts of time... There seems to be ALOT of warnings simply ignore them they are "harmless"

You can build boost test programs(in cmd or msys) with:
g++ -I"c:\tools\boost_1_45_0" -L"c:\tools\boost_1_45_0\stage\lib" -static boost_lamba_test.cpp -o a.exe
g++ -I"c:\tools\boost_1_45_0" -L"c:\tools\boost_1_45_0\stage\lib" -static boost_regex_test.cpp -lboost_regex-mgw45-1_45 -o b.exe

Lamba test:
Regex test:

Keep in mind the order of the source and libs files is important in mingw

1 comment:

  1. Thanks for saving me the frustrations of building boost on my own :)