Installing Boost Library for Linux

Home / Installing Boost Library for Linux

Installing Boost Library for Linux

December 9, 2015 | Article | No Comments

Boost is portable C++ source libraries and work well with the C++ Standard Library. It is intended to be widely useful and usable across a broad spectrum of applications.

In this article, we will discuss about how to install Boost Library within Linux. The method we use here is generic way, which means, it can be applied to any Linux distribution. However, for demonstration I will use following:

  1. Slackware64 14.0 Linux
  2. GCC (Compiler)


At least you have privileges for installing the files later.

Obtain the Materials

Boost Library has official site here.

The latest version of Boost library is version 1.53.0 which can be downloaded from sourceforge (here). While there is also Boost 1.54.0 beta available, we will use the stable version at this time.

Compile & Install

Assuming the archive is boost_1_53_0.tar.bz2 and on path ~/Downloads or /home/user/Downloads. First we have to extract the library from the archive.

cd ~/Downloads
tar -xjf boost_1_53_0.bz2
cd boost_1_53_0.bz2

Next, build bjam binary and also set some options on what to compile and where to.

Boost is a collection of libraries / modules. The whole Boost libraries will cost some time and computation for compilation. We can skip some libraries we don’t want or won’t use. To see the list of libraries need compiling, run following:

./ --show-libraries

For example, following is the result / the list of libraries on Boost 1.53.0:

  1. atomic
  2. chrono
  3. context
  4. date_time
  5. exception
  6. filesystem
  7. graph
  8. graph_parallel
  9. iostreams
  10. locale
  11. math
  12. mpi
  13. program_options
  14. python
  15. random
  16. regex
  17. serialization
  18. signals
  19. system
  20. test
  21. thread
  22. timer
  23. wave

Pick any modules you want to include in Boost, for example: filesystem,program_options, and system. In this case, we can use argument –with-library=filesystem,program_options,system to However you can also pick all / compile all the libraries, just invoke ./ without –with-library switch.

Next, choose where the library will be installed. By default, the header files will be installed to /usr/local/include and the libraries (.so, .a) will be installed to /usr/local/lib. If other path is preferred, we can use –libdir switch for specifying where library will be stored and –includedir switch for specifying where header will be stored.

Now bring all of the info and invoke like this:

./ --libdir=/usr/local/lib64 --includedir=/usr/local/include

And you could see I will build all the libraries and store the library to /usr/local/include.

Now let’s build the library


Then install by (make sure you have privileges to do)

./bjam install

At this point we have successfully installed Boost library


About Author

about author


A man who is obsessed to low level technology.

Leave a Reply

Your email address will not be published. Required fields are marked *

Social Share Buttons and Icons powered by Ultimatelysocial