Boost Installation Howto (1.38 and older)

Step 1: Install Boost

These instructions will help you install the Boost C++ libraries on a Linux system. If you already have them installed, make sure that it's the version required by the software you would like to use. If not, no problem, we'll build it now. Before you start, make sure you have the Python headers (i.e. development information) installed. Your operating system may call this package something like python-dev or python-devel. Next, download the boost release tar.bz2 file. Then, do this:

$ tar xfj ~/download/boost_1_37_0.tar.bz2
$ cd boost_1_37_0
$ ./configure --prefix=$HOME/pool
$ make
$ make install

(Whenever you see the "$" dollar sign, this means you should enter the subsequent text at your shell prompt. You don't have to be root. A few spots are marked with "sudo" to show that these do require root privileges if you are using a Python interpreter that is installed globally.)

You may adapt the file and directory names to suit your liking, however the rest of this tutorial will assume that you use these paths.

Please make sure that the Boost.Python configuration process finds the version of Python you intend to use. It is output during the configure/make stage.

If you see something like:

...failed updating 30 targets...
...skipped 2 targets...

at the end of the build process, please double-check that you have the Python headers installed. If you failed fewer targets (up to 5), you're probably ok for most of my packages, but you might still want to install libz-dev and libbz2-dev for that "perfect score".

Step 2: Tell the Dynamic Linker about Boost

If you use a bash or /bin/sh or another POSIX-compliant shell, use this command:

export LD_LIBRARY_PATH=$HOME/pool/lib:${LD_LIBRARY_PATH}

or, if you are still using a C Shell, use this:

setenv LD_LIBRARY_PATH $HOME/pool/lib:${LD_LIBRARY_PATH}

You might want to put this command in your startup script, so you don't have to type this over and over. If you forget this step, you will see errors like this one later on::

...gibberish...
ImportError: libboost_python-gcc42-mt-1_35.so.1.35.0: 
cannot open shared object file: No such file or directory
...gibberish...

Speeding up the build

Boost is seen by many as a rather heavy-weight dependency. This is view is understandable given the rather voluminous download and long build time. At its core, however, Boost is a very modular library that consists of many components that each perform one job very well.

While there are efforts underway to split up boost into more manageable downloads, here's a trick that can be used to cut down Boost's build time to about a minute on a modern machine:

This trick employs two techniques to speed up the build:

BoostInstallationHowto/Version1.38AndBelow (last edited 2009-06-14 15:16:45 by AndreasKloeckner)