Installing Boost from Source

Basic Installation

Boost uses a custom build system which may be difficult to use. The general procedure for compiling and installing Bosot is the following.

  1. ./bootstrap.sh

    Optionally give --prefix=some/path to specify a non-standard installation path. Also, see below if using a custom Python version.

  2. See below if using a custom Python version or custom GCC installation.

  3. ./b2

    Probably give -j N (similar to GNU Make) to compile with N threads.

  4. ./b2 install

    Optionally give --prefix=some/path to specify a non-standard installation path (if not done earlier).

After bootstrap.sh has been run, the file project-config.jam has been created, which can be edited to customise installation path and a lot of other things. All edits should be done before running b2.

Custom Python Version (e.g., Python 3 for Boost.Python)

This can be achieved in multiple ways. If the custom version (here assumed to be 3.3) is installed in the normal system location, then passing --with-python=python3 to bootstrap.sh should work. This adds a line similar to “using python : 3.3 ;” to project-config.jam. After compilation (running b2) the file stage/lib/libboost_python3.so should exist. If not, it did not detect Python 3 properly.

If Python is installed in a non-standard location, add the a line similar to “using python : 3.3 : python3 : /path/to/python/3/installtion/include ;” to project-config.jam, where the last path is the path to the include-folder of the Python-installation.

Custom GCC Version

Before running b2 create the file user-config.jam in the root of the home dir (see here for the full documentation). Put a line similar to “using gcc : : /path/to/g++-4.8” in the file.

Compiling Graphviz with svg:cairo

Graphviz can load SVG images and place them inside vertices. However, the specific case where the output is PDF requires that Graphviz is compiled with librsvg and libpangocairo. Unfortunately this is not the case for the default package in Ubuntu. To compile a custom version with these libraries you can do the following (on Ubuntu).

  1. Install the dev-versions of the libraries: sudo apt-get install librsvg2-dev libpango1.0-dev.
  2. Download the source package of Graphviz and do the normal autotools dance. Note that the build system of Graphivz does not currently support out-of-source builds.


Graphviz and OpenBabel

Put the content of graphvizObabel.sty in the preamble (or use \usepackage{graphvizObabel} when the file is in the same directory). Use pdflatex as compiler with the -shell-escape option (don’t use that option with code you don’t trust!). The following macros are now available. They should all be used as substitude for \includegraphics. The options in all macros can be omitted, and they will be passed down to \includegraphics.

  • \graphvizBase[options]{layout engine}{complete graph data}: for compiling and including a general graphviz graph.
  • \neatoGraph[options]{graph data}: expands to \graphvizBase[options]{neato}{graph {graph data}}
  • \neatoDigraph[options]{graph data}: expands to \graphvizBase[options]{neato}{digraph {graph data}}
  • \obabel[options]{smiles string}: uses OpenBabel to draw the molecule in 2D.

The graphviz macros requires graphviz to be installed and have dot in the path. The obabel macro requires OpenBabel 2.3 or higher to be installed and have obabel in the path.

See also a blog post by Noel O’Boyle, for additional information.