How to build Boost on Linux
Ubuntu tends to ship an old version of Boost. New versions of the Boost 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 bootstrap.sh . 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:
$ ./bootstrap.sh --prefix=boost_output
./bootstrap.sh --prefix=boost_output --with-python=
./bootstrap.sh --prefix=boost_output --with-python=python3
./bootstrap.sh --prefix=boost_output --with-icu=
- 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