QuantLib installation on Linux

Boost Installation

If you don't require a particular Boost version, the path of least resistance is to install the one packaged for your distribution; for instance, on Ubuntu you would execute:

  sudo apt-get install libboost-all-dev

while on Fedora the above would be:

  sudo yum install boost-devel

Using a packaged distribution has the additional upside of installing Boost in a default location where the compiler can find it. If you can, go for it and skip the rest of this section.

If, instead, you want a particular version of Boost, or if you don't have administrative rights on your machine, you'll have to compile Boost yourself. Instructions for that are available on the Boost site at http://www.boost.org/more/getting_started/index.html. In this case, you might end up with a Boost installation in a non-standard location; take a note of it, as you'll need it later.

QuantLib Installation

Installation from package repositories

If you don't need to modify the library, you might want to skip the compilation and install a precompiled binary version; unofficial RPM and DEB packages should be available for your distribution through the usual channels. Note that the default version on Debian and Ubuntu distributions might be lagging behind; to get a recent one, use the "unstable" (a.k.a. "Sid") distribution on Debian or Dirk Eddelbuettel's PPA on Ubuntu.

If you want to modify the library, instead, you'll have to compile it yourself as described in the next section.

Installation from a released version

You can download released QuantLib versions from GitHub at https://github.com/lballabio/QuantLib/releases.

Once you have the tarball, extract it by executing:

tar xzf QuantLib-1.4.1.tar.gz

(1.4.1 is the most recent version at the time of this writing; you might have downloaded another one.) This creates a folder QuantLib-1.4.1; enter it and configure QuantLib by executing:

  cd QuantLib-1.4.1

The above step is customizable, if you want: run

  ./configure --help

to obtain a list of the configuration options. In particular, the --prefix option can be used to install QuantLib in a location other than the default (/usr/local).

This is also the step where you might have to tell configure about the location of your Boost installation, if that's not a standard one. If, for instance, you installed the Boost headers in /home/foo/include and the libraries in /home/foo/lib, execute:

  ./configure --with-boost-include=/home/foo/include --with-boost-lib=/home/foo/lib

to setup the build correctly. Finally,


builds the library and

  sudo make install

installs it (if you specified a location with --prefix that doesn't need admin permissions, you won't need to use sudo before make install). Depending on your system, you might also need to run

  sudo ldconfig

to notify the dynamic linker that a new shared library is available. (The above works with the default prefix, /usr/local, on most system; if you chose another one, or if your programs still can't find libQuantLib.so, you'll need to add the location of the library to /etc/ld.so.conf before running ldconfig. For a default installation, that would be /usr/local/lib.)

Once you're done, you can try to compile and run an example to check your installation. If you installed everything in the default location, you can simply execute:

  cd Examples/BermudanSwaption
  g++ BermudanSwaption.cpp -o BermudanSwaption -lQuantLib

Otherwise, you'll have to specify the location of your Boost and QuantLib installations with corresponding -I and -L flags; for instance, the middle step above would be:

  g++ BermudanSwaption.cpp -I/home/foo/include -o BermudanSwaption -L/home/foo/lib -lQuantLib

if you ran ./configure with prefix /home/foo.

Installation from a git repository

If you want to compile from a checkout of a git repository (such as the official one at https://github.com/lballabio/quantlib, or a fork of it that you might have created) you'll need an additional step at the beginning of the process. Before running the ./configure script, you'll have to create it by executing


To do this, you'll need automake, autoconf and libtool. Again, they're packaged for most Linux distributions; on Ubuntu, you would get them by running

  sudo apt-get install automake autoconf libtool

After the execution of ./autogen.sh, the installation proceeds as in the previous section.