Menu

Install from sources

Eugen Wintersberger

Installing software from the plain source code can be a quite tedious job. So if you are a normal user and have never compiled a program from its source code by yourself you are maybe on the wrong page.

Requirements

To build the source distribution some programs must be installed

  • SCons - the primary build tool
  • doxygen - used for generating the API documentation
  • pdflatex - use for generating the users and administrators guide (in most cases if should be enough if you have a working Latex distribution installed on your system)
  • graphviz - required by doxygen
  • python - required by SCons
  • pygments - a syntax highlighter (for documentation)

In addition to this programs a couple of libraries are needed

  • BOOST - from which shared pointers, static asserts, and numeric conversion is taken
  • CPPUNIT- a C++ unit test framework
  • libpniutils - utility library
  • hdf5 - binary file format

If you are a Linux user you are most probably on the lucky side since most of these programs are included in the package library of modern Linux distributions. For Windows the situation is more difficult. Windows users may lookup the installation procedure for all of the required tools and libraries on the project sites of the software.

Building on Linux

Once all dependencies (see above) are satisfied one can start with the build. To simply build the code run

$>scons

in the root directory of the source tree. Scons tries to do some auto-configuration to find out if you have all necessary libraries installed and adds them to the link list if it can find them. If you have libraries installed in non-standard locations you can use several build variables on the command line to let scons know where to look for them. There are basically three of these build variables

  • BOOSTPREFIX - determines the prefix for your boost installation
  • HDF5PREFIX - for the prefix of the HDF5 code
  • PNIUPREFIX - the prefix for the libpniutils installation.

For all three variables the build system will assume that libraries are installed under /lib and header files below /include with respect to the installation prefix.
If you have, for instance, BOOST installed below /opt/boost you can use the following command line to build libpninx

$>scons BOOSTPREFIX=/opt/boost

To install the code use

$> scons install

Which will try to install the library along with its development files and documentation below the default installation prefix which is /usr on Linux systems. Clearly you need administrative permissions to install software at this location (in other words: you must be root). If you want to install the library to a different location the PREFIX build variable can be used. For instance

$> scons PREFIX=/opt/pninx install

will install everything below /opt/pninx. There are three other installation related build variables which allow fine grained control over where code will be installed

  • LIBDIR - installation path for libraries
  • INCDIR - installation path for header files
  • DOCDIR - installation path for documentation

These build variables override the PREFIX variable. For instance if you use

$> scons PREFIX=/usr/local LIBDIR=/usr/local/lib64 install

Everything goes below /usr/local but the libraries will not be installed in /usr/local/lib but in /usr/local/lib64.

In the examples above scons was always called without a particular target. In such a case the default target all. There are several other targets available

  • library - which will only build the library code
  • test - for only building test code
  • doc - builds the API documentation
  • install - installs the package (and runs a build if it has not been done yet)
  • pdfdoc - build PDF documentation (users and administrators guide)
  • pdfdocinstall - installs the PDF documentation.

The default target all is equivalent to calling

$> scons library test doc

The PDF documentation is not built (and thus not installed) by default in order to ensure a successful build even on machines with an outdated Latex installation.

Building on Windows

Not done yet.


MongoDB Logo MongoDB