How to build Boost on Linux

Ubuntu tends to ship an old version of Boost. New versions of this library are released regularly. Thankfully, it is pretty easy to build and use Boost on Linux:

  • Download the zip of the latest version of Boost from here. Unzip it and you should get a directory, for example: boost_1_63_0.

  • If you need to build Boost with Unicode support, which is a good idea, then install this package:

$ sudo apt install libicu-dev
  • The program used to generate the build configuration and compilation script is You can check what options it takes as input using its --help argument. At the very least, we need to specify the --prefix argument, providing the location where Boost will place the files it builds. To generate a build configuration that places built files inside a boost_output directory:
$ ./ --prefix=boost_output
  • To generate build configuration with Python 2.x support:
./ --prefix=boost_output --with-python=
  • To generate build configuration with Python 3.x support:
./ --prefix=boost_output --with-python=python3
  • To generate build configuration with Unicode support:
./ --prefix=boost_output --with-icu=
  • To perform the actual build, we invoke the b2 program generated by the above command:
$ ./b2 install
  • To build in parallel using all your CPU cores, specify that number:
$ ./b2 install -j 8
  • If the build was successful, you will find two subdirectories: include of include files and lib of library files in the directory you specified to the --prefix argument above. These are enough to include in your C++ source files and to link with for compilation.

Tried with: Boost 1.63.0, GCC 4.8.4 and Ubuntu 14.04

One thought on “How to build Boost on Linux

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.