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

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
  • python developement files - you need this to build the python code

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. If BOOST is not installed in one of the standard locations you can add the prefix of you BOOST installation with

$>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/pniutils install

will install everything below /opt/pniutils where the libraries go under /opt/pniutils/lib, the headers to /opt/pniutils/include, and the documentation to /opt/pniutils/share/doc/libpniutils-doc. Usually this should give you enough control over your installation. However, in some cases this is not enough and you want to tell scons the individual directories where to install the software. For this purpose three environment variables that can be passed to scons during build and/or installation

  • LIBDIR - tells scons where to install libraries
  • DOCDIR - where to install documentation
  • INCDIR - where to install header files

If you use one of these build variables its value overrides the installation path that would be defined by prefix. So for instance if you use

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

Libraries will go to /usr/local/lib64 and not /usr/local/lib as they would have done using only PREFIX.

Building on Windows

Not done yet.


MongoDB Logo MongoDB