Compiling and installing Geneva

Target systems

The main development work of the Geneva library collection is currently done on Ubuntu and Debian. It is likely that Geneva compiles on most other Linux and Unix systems using the GNU Compiler Collection. 

We have recently managed to compile Geneva on MacOS 10.9 using the Clang compiler, which comes with the development suite. Note that support for MacOS is experimental at best. We have also successfully built Geneva with Clang on BSD.

The authors would very much appreciate your feedback through the Geneva Development Forum.

For further information, please also have a look at our user-manual, available from the Downloads section of our web page.

In case you encounter any bugs or issues please let us know through the Geneva bug tracker.

Prerequisites

The build system uses CMake in version 2.8 or later.

You will also need the Boost libraries in version 1.48 or newer. See either the section "Installing Boost in Debian/Ubuntu" or the section "Compiling Boost" below for more details. We currently recommend Boost 1.55 .

Please do make sure that Boost has been compiled with the same C++ standard mode that you wish to use for Geneva (in particular, do not mix libraries compiled  in C++11 and C++98 mode.

If you wish to build from the source code available from our version control tree you will also need the Bazaar version control tools. This is not needed if you only intend to build the official releases from the provided "tar balls".

Installation prerequisites in Debian/Ubuntu

The following command should be enough to install the required prerequisites in any modern Debian/Ubuntu release:

sudo apt-get install --no-install-recommends cmake bzr g++

sudo apt-get install --no-install-recommends libboost-dev libboost-date-time-dev \

 libboost-filesystem-dev libboost-program-options-dev libboost-regex-dev \

 libboost-serialization-dev libboost-system-dev libboost-test-dev \

 libboost-thread-dev

See the section "Installing Boost in Debian/Ubuntu" below, though. Alternatively, you may want to install a custom Boost version from its source tree, available from http://www.boost.org.

Installation prerequisites on MacOS X (tested only 10.9)

You should first install the Xcode environment from the App store. This will give you a working C++ compiler. You should also install Mac versions of CMake and bzr.

We recommend that you compile a custom boost version. With Boost 1.55, unpack the archive, then run the following commands inside of the main directory of the boost source tree:

./bootstrap.sh --prefix=/opt/boost155/

sudo ./b2 -j 4 install

This assumes a system with 4 cores. The directories can of course be adapted.

MacOS contains two incompatible std C++ libs: libstdc++ and libc++ . With MacOS 10.9, libc++ has become the default. In order to compile Geneva with Mavericks (a.k.a. 10.9) you need to make sure that libstdc++ is being used both in Boost and in Geneva. All necessary modifications have been made in the Geneva build files so that the code  (hopefully) compiles cleanly with libstdc++ . For Boost, however, you need to do some manual work:

 

First create a file /etc/site-config.jam with the following content (or add the lines to an existing file, you could also use user-config.jam in your home-directory, if your are unsure about creating a system-wide configuration file): 

using clang : 98

    : "/usr/bin/clang++"

    : <cxxflags>"-std=c++98 -stdlib=libstdc++" <linkflags>"-stdlib=libstdc++ -macosx_version_min=10.8"

    ;

This will enforce the usage of libstdc++ and the 98 C++ standard. Now bootstrap boost, then call

./b2 -j4 -d+2 toolset=clang-98 define=BOOST_SYSTEM_NO_DEPRECATED variant=release threading=multi address-model=64 stage install

Through the increased verbosity (through -d+2) you can check that the correct arguments are passed to the compiler.

Building and installing Geneva

To build the Geneva library use one of the two procedures enumerated below.

a) The easy (but more restricted) way

Geneva comes with a build script that facilitates the somewhat complicated call to cmake. Assuming you are in $HOME/build and Geneva is in $HOME/Geneva, copy the config file over:

cp ../Geneva/scripts/genevaConfig.gcfg ./myGenevaConfig.gcfg

Adapt the variables in the file appropriately. Then call

sh ../Geneva/scripts/prepareBuild.sh ./myGenevaConfig.gcfg

Finally build and install in the usual way:

make # Use the -j2 switch if you have a dual core CPU

sudo make install  # Assuming you want to install to a system directory

You can clean up the build folder by running "make clean" inside of $HOME/build .

b) Direct call to cake

In order to compile this project and the examples: Create a build directory anywhere in the file system and change into it. Then call

cmake /path/to/geneva-top-dir

followed by a simple "make" and "make install". In order to choose a custom installation directory (instead of the default /opt/geneva), call

cmake /path/to/geneva-top-dir -DCMAKE_INSTALL_PREFIX="/where/the/library/goes"

Somewhat older distributions won't provide a new enough version of Boost (i.e., at least 1.48). You might thus have compiled your own version of Boost, and have installed it in a non-standard location. In order for CMake to find this directory, you can either edit the top-level CMakeLists.txt file and hard-code the paths (uncomment the appropriate entries there), or provide the necessary variables at the command line when calling cmake. This can be done in the following way (assuming that Boost is installed in /opt/boost155):

cmake /path/to/geneva-top-dir -DBOOST_ROOT="/opt/boost155"\

                              -DBOOST_INCLUDEDIR="/opt/boost155/include/boost/"\

                              -DBOOST_LIBRARYDIR="/opt/boost155/lib"

Adding another define -DGENEVA_BUILD_TYPE="Release" or -DGENEVA_BUILD_TYPE="Debug" switches between Release and Debug (default) builds. Adding a -DCMAKE_VERBOSE_MAKEFILE="1" will allow you to see the command line that was used to call the compiler. This command needs to be called on a single line.

Have a look at the configuration script prepareBuild.sh for some of the options  available for a direct call to cmake,

Making the libraries known to the system

a) On Linux

Note that under Linux, you will have to make the installation directory known to the linker, so henceforth you can link to the library automatically. Under most Linux systems this can be done by creating a file /etc/ld.so.conf.d/geneva.conf with the content

 

/where/the/library/goes/lib

 

You then need to execute "ldconfig -v". Another possibility is to export the library location prior to running programs based on Geneva:

export LD_LIBRARY_PATH="/where/the/library/goes/lib:$LD_LIBRARY_PATH"

You should follow a similar procedure for the boost libraries, if you have compiled your own version of it.

b) On MacOS

Currently we simply set the DYLD_LIBRARY_PATH to the Geneva and Boost library directories. Please do let us know about more convenient ways of permanently setting library paths.

Recommended Software

By default a Geneva optimization emits information suitable for ROOT (see root.cern.ch). ROOT is a C++ analysis framework widely used in particle physics. It is built around the C++ interpreter cint. It is recommended to install ROOT in your system, as also some of the examples emit information in the ROOT format (they are essentially writing ROOT programs). Note, though, that ROOT is not required to perform optimization with the Geneva library collection.

Appendix: Installing Boost in Debian/Ubuntu

NOTE: If you install a custom version of Boost, one of the more common errors sources are header files taken from one version of Boost, while the libraries are taken from another source. Check for this first if you run into compilation problems with Geneva. Using the libraries provided by your system is thus the recommended way.

Both Debian 6.0 "Squeeze" and Ubuntu 10.10 "Maverick Meerkat" or newer have the required Boost packages to be able to compile and run Geneva:

libboost-dev

libboost-date-time-dev

libboost-filesystem-dev

libboost-program-options-dev

libboost-regex-dev

libboost-serialization-dev

libboost-system-dev

libboost-test-dev

libboost-thread-dev

You can install them all at once with the command:

sudo apt-get install libboost-dev libboost-date-time-dev libboost-filesystem-dev \

libboost-program-options-dev libboost-regex-dev libboost-serialization-dev \

libboost-system-dev libboost-test-dev libboost-thread-dev

Appendix: Compiling Boost on Linux

Download Boost from http://www.boost.org and extract the compressed file. This will create a folder "boost_1_55_0", for instance. Change to that folder and, assuming Boost should be installed in /opt/boost155 (which should be writable), execute

./bootstrap.sh --prefix=/opt/boost155

./b2 install

 

You can add a "-j 2" to the second command if your system has two cores. This will speed up the otherwise quite long compilation time.

Once done you can use the Boost include path as explained above, with BOOST_ROOT="/opt/boost155".

If FindBoost.cmake has trouble finding the Boost libraries in the specified location, it might help to compile the library with the flag "--layout=versioned" or "--layout=tagged".

Appendix: Known bugs and (possibly) fixes on some platforms

See the KNOWNBUGS file in the main source folder.