Wednesday 24 February 2016

Boost on Ubuntu

This post describes how to install the boost library on Ubuntu.

Install the available package

If it doesn't need to be the latest version of boost, just install the version Ubuntu provides.
sudo apt-get install libboost-all-dev

Install latest version

If you want a more current version of boost than provided by Ubuntu, download and install it manually like showed here. At first download the version you want. I downloaded version 1.60 and also tried with version 1.57, you can chose whichever you want.

wget -O boost_1_60_0.tar.gz http://sourceforge.net/projects/boost/files/boost/1.60.0/boost_1_60_0.tar.gz/download
tar xzvf boost_1_60_0.tar.gz
cd boost_1_60_0/

Install all dependencies required to run boost without problems

sudo apt-get install build-essential g++ python-dev autotools-dev libicu-dev build-essential libbz2-dev libboost-all-dev

Prepare the installation with bootstrap. You can define the location it will be installed later with the prefix argument.

./bootstrap.sh --prefix=/usr/local
Then in the final step install boost with b2.
sudo ./b2 install

4 comments:

  1. Hi Lussi,
    I am trying to install Boost 1.64.0 version. But whenever i install it always installed 1.54.0 version. Seems that when we run this command
    "sudo apt-get install build-essential g++ python-dev autotools-dev libicu-dev build-essential libbz2-dev libboost-all-dev"
    it create the problem.
    Any idea how to install 1.64.0 version. I follow your instruction.

    ReplyDelete
    Replies
    1. with the package libboost-all-dev you install the currenctly available boost version for your system. What operation system are you trying to install it on? And did you run the two following steps to install the boost version you just downloaded?

      Delete
  2. hi Lussi,
    I am using Ubuntu 14 LTS, First i uninstall all Boost lib using
    sudo apt-get --purge remove libboost-dev
    sudo apt-get --purge remove libboost-all-dev
    Further, i removed
    /usr/local/lib/libboost* and /usr/local/include/boost

    Than i followed your instruction:

    If you want a more current version of boost than provided by Ubuntu, download and install it manually like showed here. At first download the version you want. I downloaded version 1.60 and also tried with version 1.57, you can chose whichever you want.

    wget -O boost_1_60_0.tar.gz http://sourceforge.net/projects/boost/files/boost/1.60.0/boost_1_60_0.tar.gz/download
    tar xzvf boost_1_60_0.tar.gz
    cd boost_1_60_0/

    Install all dependencies required to run boost without problems

    sudo apt-get install build-essential g++ python-dev autotools-dev libicu-dev build-essential libbz2-dev libboost-all-dev

    Prepare the installation with bootstrap. You can define the location it will be installed later with the prefix argument.

    ./bootstrap.sh --prefix=/usr/local

    Then in the final step install boost with b2.

    sudo ./b2 install

    ReplyDelete
  3. My system is still showing previous version of Boost 1.58.
    after following steps of installation of 1.60. I haven't got any errors during installation

    ReplyDelete