How to install latest Boost library on Ubuntu

At the time of writing, the latest version of Boost library in official Personal Package Archive (PPA) is 1.55.

$> aptitude search boost
p libboost1.55-all-dev - Boost C++ Libraries development files (ALL)

Which is far from the latest. In order to install the latest Boost version (including all libraries), you need to download the latest source code from Boost website (currently the latest version is 1.69.0).

$> cd /tmp/
$> wget https://dl.bintray.com/boostorg/release/1.69.0/source/boost_1_69_0.tar.gz
$> tar xzvf boost_1_69_0.tar.gz

Now you need to specify where to put the include headers and libraries, after the compiling source code.

$> ./bootstrap.sh --prefix=/usr/

Let’s build the source code (that takes a while).

$> ./b2

The final step is to install the headers and libraries, or simply to copy them to the location specified with –prefix command line option.

$> sudo ./b2 install

Check installed Boost version

Now you have installed the latest version of Boost, let’s try to compile C++ source code to print Boost version to verify that’s all works fine.

$> g++ -Wall -g -ggdb -Werror -std=c++11 -o get_boost_version get_boost_version.cpp
$> ./get_boost_version
Boost version: 1.69.0

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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