Installation instructions

O2scl installation is generally similar to that for GNU-style libraries. The file INSTALL has some details on this procedure. Generally, you should be able to run ./configure and then type make and make install. More information on the configure command can also be obtained from ./configure –help. O2scl assumes some C++11 support, typically that which was supported in gcc-4.4.7 and higher. The ./configure script attempts to determine the proper compiler flags for C++11 support, e.g. -std=gnu++11. If this fails, you may have to add the proper C++11 flag to the CXXFLAGS environment variable manually before the ./configure script. The documentation is included in the O2scl release distribution and automatically installed by make install.

O2scl requires the Boost (any relatively recent version) and the GSL libraries (version 1.16 or later). If the configure script cannot find Boost or GSL, you may have to specify their location in the CXXFLAGS and LDFLAGS environment variables (./configure –help shows some information on this). In order to allow O2scl to take advantage of new functionality in GSL versions 2.0 and later, you can add –enable-gsl2 to the ./configure script. Along with GSL, a CBLAS library is also required, and ./configure will look for libcblas first, and if not found then it will look for libgslcblas. If neither is present, then you may have to manually specify a CBLAS library using the LIBS and LDFLAGS environment variables.

Compiling with the readline and HDF5 libraries is optional, but they are assumed to be present by default. To compile without these libraries, you will need to use the arguments –disable-readline or –disable-hdf to ./configure, respectively. Note that HDF5 is currently required for the physics sub-libraries, so –disable-hdf should be accompanied by the –disable-eoslib and –disable-partlib flags.

After make install, you may test the library with make check or make o2scl-test. At the end, the phrase "All O2scl tests passed" indicates that the testing was successful. You may also run make o2scl-test in the individual subdirectories of the src directory to individually test the classes and functions in that part of O2scl . The testing code in src/base/lib_settings_ts.cpp can be useful in finding out how O2scl was compiled. After make o2scl-test, running src/base/lib_settings_ts will output several of the installation settings.

O2scl uses Travis CI (see ) to ensure that compilation and testing works on standard Ubuntu and Mac OS X environments.

Compiling on Linux

For example, to install O2scl on Ubuntu, begin by installing g++, GSL (the libgsl0-dev package), Boost (the libboost-all-dev package), GNU readline (the libreadline-dev and libncurses-dev packages), and HDF5 the libhdf5-dev package). In older versions of Ubuntu, the HDF5 package only supports the older (and now deprecated) HDF5 API. If you get HDF5 errors you may have to install HDF5 from source. You can then install O2scl from one of the release distributions by using the standard GNU ./configure script and then invoking make and make install.

If you want to install from source (without generating the documentation), then you must first install the autoconf and libtool packages. Then you can use something along the lines of

git clone
mkdir m4
autoreconf -i

Then, you will either need to generate the documentation from doxygen using make o2scl-doc or use make blank-doc to create blank documentation. Then you can proceed using make and make install.

Compiling on Mac OS X

The easiest way to perform compilation on Mac OS X is with homebrew. Use:

brew tap awsteiner/science
brew install o2scl

to install O2scl . There are a few options for brew install. The option –with-check performs the build-time tests and the option –with-examples double checks that the examples can also be compiled and executed. The homebrew recipe for O2scl uses the Mac OS X compiler clang. Homebrew also supports the installation of the current version directly from the repository using the –HEAD option to brew install.

Alternatively, it is also possible to install directly from source with the ./configure script as described above.

Optional linear algebra libraries

Most classes and functions which require linear algebra can be used with the Eigen ( or Armadillo ( vector and matrix objects. This can be specified in the configure command with –enable-armadillo or –enable-eigen. Note that the O2scl classes which use Armadillo use matrix decompositions so Armadillo must be compiled with LAPACK support, and you may need to specify the location of the LAPACK libraries manually. If you are installing on Mac OS X with homebrew, the options –with-eigen and with-armadillo can be used.


Range-checking for vectors and matrices is turned on by default. You can disable range-checking by defining -DO2SCL_NO_RANGE_CHECK, e.g.


Optional physics libraries

The separate libraries O2scl_eos and O2scl_part are installed by default. To disable the installation of these libraries and their associated documentation, run ./configure with the flags –disable-eoslib or –disable-partlib. Note that O2scl_eos depends on O2scl_part so using –disable-partlib without –disable-eoslib will not work. Note also that both O2scl_part and O2scl_eos require HDF5 support.

More configure flags

There are several warning flags that are useful when configuring and compiling with O2scl . See the GSL documentation for an excellent discussion, and also see the generic installation documentation in the file INSTALL in the O2scl top-level directory. For running configure, for example, if you do not have privileges to write to /usr/local,

CPPFLAGS="-O3 -I/home/asteiner/install/include" \
LDFLAGS="-L/home/asteiner/install/lib" ./configure \

In this example, specifying -I/home/asteiner/install/include and -L/home/asteiner/install/lib above ensures that the GSL libraries can be found (this is where they are installed on my machine). The –prefix=/home/asteiner/install argument to ./configure ensures that O2scl is installed there as well.

Generation of documentation

The O2scl documentation is generated with Doxygen and packaged in with every release file. In principle, the documentation can be regenerated by the end-user, but this is not supported and requires several external applications not included in the distribution.

The most recent release documentation is available at . The documentation for previous releases is not on the web, but still available in the release .tar.gz file.


While there is no explicit "uninstall" makefile target, there are only a couple places to check. Installation creates directories named o2scl in the include, doc and shared files directory (which default to /usr/local/include, /usr/local/doc, and /usr/local/share) which can be removed. The acol command-line utility is installed to /usr/local/bin . Finally, all of the libraries are named with the prefix libo2scl and are created by default in /usr/local/lib.

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).