Building Boost on windows

Recently I need specific boost binary for my code, so I compiled boost. That was my first time and this is short useful note about it.
1. Go to boost\tools\build\v2
2. Run bootstrap.bat
3. Run b2 b2 install –prefix=[directory to install]
4. Add prefix\bin to system environment
5. Go to boost directory and run b2 :
b2 –build-dir=[directory to put intermediate file] toolset=[see below] –build-type=complete stage threading=[sea below] link=[see below]

At step 5 you notice that there are some compile time configurations avalable like build-type, toolset, threading and link. Well there are another option avaible, but I will only introduce you to three important option : toolset, threading and link.

As expected Boost is compatible with most popular C++ compiler out there, you can refer to this page :

[Name convention]
To understand what is threading and link mean easier, you should look to boost compiled lib naming convention. Boost lib consist with this name structure :
lib-[library_name]-[toolset used]-[threading tag]-[ABI tag]-[Boost Version].lib

for detailed information you should read this page :

[Build specific library]
To build specific library use –with-[library name] switch, example compiling boost-thread :
b2 –build-dir=intermediate toolset=msvc –build-type=minimal stage –with-thread

Note :
– Don’t forget to modify your boost-config.h to further customize boost to your need.
– You could also look at Jamroot file to see available build option
– Find compiled lib in stage directory
– In my case I built boost-thread, and it will not build if you enable BOOST_NO_EXCEPTIONS

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s