Tag Archives: Boost

Building Boost library from source on Ubuntu

On Ubuntu, building the Boost library from source can be tricky at times. So, I thought of putting an article together to help someone trying the figure out the same. So, on your Ubuntu machine once you have downloaded the Boost source files (here), you can follow the following steps to build it (I have picked boost_1_54_0.tar.gz for demonstration) :

  1. Unzip and change into the boost source directory.
    tar -xf boost_1_54_0.tar.gz && cd boost_1_54_0
  2. Run bootstrap.sh, this will generate the necessary config files and “b2” (the build tool).
  3. Run b2 to build & install all (or desired) boost libraries (refer “./b2 –help” for explanation on individual options used):
    ./b2 --build-type=complete --layout=versioned --prefix=./install -q install

That’s all! The build (build-type=complete) would take a while to finish, so be patient. Also, the statndard Ubuntu installation might not have some headers required for the complete build. In my case, installing the following 2 packacges was sufficient :

  • libbz2-dev
  • python-dev

A more detailed set of instructions can be found here.