Installing from source

From Gerris

Jump to: navigation, search

Before installing from source, you should consider using the pre-built packages, which facilitates both installation and maintenance of Gerris and GfsView.

The Gerris environment consists of two main parts: the Gerris solver itself and the visualisation application GfsView. The Gerris solver does not need interactive display and can run purely in terminal mode. This is useful when running applications on supercomputing systems which are often used in "batch mode".

The Gerris solver depends on the GTS library for geometrical operations and object-oriented programming. The GTS library in turns depends on the Glib library, a set of useful extensions for C programming. Glib is installed as part of the standard installation on many Linux systems, however the corresponding development files (library header files etc...) usually need to be installed explicitly.


Installing the glib development files

Depending on your system, you have the choice between two installation procedures.

Using pkg-config

Linux systems use an utility called pkg-config to find out about development libraries installed on the system. Other versions of UNIX may also have pkg-config installed but your luck may vary.

To check whether you already have the development files for glib on your system do:

% pkg-config glib-2.0 --modversion

If the development files are installed you will get something like:


i.e. the installed version number of glib. Otherwise, you will need to install the development files first. It is most easily done by using the packaging system of your linux distribution. For example on a debian-based distribution just type:

% sudo apt-get install libglib2.0-dev

RPM-based distributions (Red Hat, Fedora, Suse etc...) will have similar tools but the package name may be different. Note also that the some of the optional modules have added dependencies. If you are using a Debian/Ubuntu system, the next section provides an easy way to also install these dependencies. For other systems, you may want to read the section below on modules dependencies.

Dependent packages for Debian/Ubuntu

They can be installed by running the following command:

% sudo apt-get install libglib2.0-dev libnetpbm10-dev m4 libproj-dev \
libgsl0-dev libnetcdf-dev libode-dev libfftw3-dev libhypre-dev libgtkglext1-dev libstartup-notification0-dev ffmpeg

In Ubuntu 14.04 ffmpeg will need a private repository, probably found here: linked from

If you need MPI, you might need to install OpenMPI or another variant of MPI. No need to compile the MPI library:

% sudo apt-get install libopenmpi-dev

Choosing where to install the libraries

GTS, Gerris and GfsView use the standard GNU build system which by default installs the packages it builds in the /usr/local directory. You will normally need administrator privileges (i.e. root password) to install packages there.

You can choose another installation directory using e.g.

% ./configure --prefix=$HOME/local

if you want to install the packages somewhere else (e.g. somewhere in your user home directory).

Note that in both cases you need to somehow tell the system that you installed new executables and libraries there. See the instructions below for details.

Compiling and installing GTS

I will assume that you either downloaded and unpacked a source tarball or used darcs to get a directory called gts. Compilation and installation should then be as simple as:

% cd gts
% ./configure (--prefix=... is optional)
% make
% sudo make install (or just 'make install' if installing locally)

In order for the system to know that a new dynamic library has been installed, you need to:

  1. If installing in /usr/local:
    1. check that the file /etc/ exists and contains the line /usr/local/lib (if not, add it)
    2. then run
      % sudo /sbin/ldconfig

  2. If installing locally do (assuming you use bash as shell):
    % export PATH=$PATH:$HOME/local/bin
    % export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/local/lib
    % export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$HOME/local/lib/pkgconfig

Compiling and installing Gerris

Before compiling Gerris you need to decide whether you want to run Gerris in parallel. The parallel version of Gerris depends on an implementation of the MPI (Message Passing Interface) standard. If you do, you will need to install the MPI libraries first. On an Ubuntu/Debian system just do:

% sudo apt-get install openmpi-bin libopenmpi-dev

Note that the compilation of the parallel version of Gerris requires a working mpicc command (i.e. as provided by the openmpi-bin package above).

Otherwise the process is almost identical to the GTS installation. Again assuming you either downloaded and unpacked a source tarball or used darcs to get a directory called gerris, do:

% cd gerris
% ./configure
% make
% sudo make install

When installing in /usr/local do not forget to update the dynamic linker database:

% sudo /sbin/ldconfig

If everything went well you should be able to run the following (if using a csh based shell, remember to rehash first):

% gerris2D -V

and get the version number of your Gerris installation.

Compiling and installing GfsView

GfsView is a graphical application using OpenGL and the GTK Toolkit. The GTK toolkit is the basis of the GNOME desktop environment and of many graphical applications running on most Linux distributions. Compiling GfsView requires the installation of the development files for the OpenGL, GTK and GtkGlExt libraries. If you also want support for OpenGL text fonts within GfsView (used to display labels, color scale etc...) you will also need the FTGL library. On an Ubuntu/Debian system do:

% sudo apt-get install libgtk2.0-dev libgtkglext1-dev libstartup-notification0-dev libftgl-dev

GfsView also provides a non-graphical version (command gfsview-batch) which can run without any graphical display. Off-screen OpenGL rendering is done using the OSMesa library (which is part of the Mesa OpenGL implementation).

The batch command is useful for generating on-the-fly animations on systems without a graphical terminal, by using the Gfsview module with GfsOutputView. This is designed to require a minimal set of libraries: an OpenGL library (typically software-rendering such as implemented in Mesa), OSMesa and optionally FTGL. GTK, GtkGLExt are not required when installing only gfsview-batch. This should allow a reasonably straightforward installation on most UNIX systems (supercomputers in particular).

To install OSMesa on an Ubuntu/Debian system do:

% sudo apt-get install libosmesa6-dev

Then as usual do:

% cd gfsview
% ./configure
% make
% sudo make install

To install Mesa and OSMesa from source, see the Standalone OSMesa page.

Module dependencies

The optional modules may require additional dependencies. If you are using a Debian/Ubuntu system these dependencies are easy to install. Other systems may have similar pre-packaged libraries, however they are usually not as complete as Debian and some libraries may not be packaged.

The dependencies will be checked by the ./configure script and the corresponding modules will only be installed if they are present. A summary of which modules will be installed is given by ./configure. To find out why a particular module is not going to be installed, you need to check further up in the ./configure output which particular library failed to be detected.

Hypre installation from source

If Hypre is installed from source, some manipulations are needed so that Gerris can find it during compilation. If Hypre is to be installed in the folder /usr/local/hypre, do:

% export HYPRE=/usr/local/hypre
% cd hypre-version/src
% ./configure --prefix=$HYPRE --enable-shared
% make
% make install

When configuring Gerris, tell it about the Hypre installation by prepending CPPFLAGS and LDFLAGS environment variables:

% CPPFLAGS=-I$HYPRE/include LDFLAGS="-L$HYPRE/lib -lmpi_cxx" ./configure (--prefix=... is optional)

The summary output of ./configure should now say "yes" for the Hypre module. Finish the compilation and installation of Gerris as usual:

% make
% make install

To use the module, see the Hypre wiki page.

Recipes for specific systems

Fitzroy IBM AIX 6.1

See also:

mkdir local/src
cd local/src
export http_proxy=
curl -L -O
curl -L -O
curl -L -O
gtar xzf gts-snapshot.tar.gz
gtar xzf gerris-snapshot.tar.gz
gtar xzf gfsview-snapshot.tar.gz
cd gts-snapshot-*
env OBJECT_MODE=64 CC=xlc_r F77=xlf_r CFLAGS="-O3" ./configure --prefix=$PREFIX
gmake && gmake install
cd ../gerris-snapshot-*
export PATH=$PREFIX/bin:$PATH
sed 's/cc_r/xlc_r/g' < /usr/bin/mpcc > $PREFIX/bin/mpicc
chmod +x $PREFIX/bin/mpicc
export MP_HOSTFILE=`pwd`/host.file
export MP_PROCS=1
hostname > $MP_HOSTFILE
hostname > $HOME/.rhosts
env OBJECT_MODE=64 CC=xlc_r F77=xlf_r CFLAGS="-O3" ./configure \
--prefix=$PREFIX \
gmake && gmake install
cd ../gfsview-snapshot-*
hostname > $MP_HOSTFILE
env OBJECT_MODE=64 CC=xlc_r CFLAGS="-O2 -I$PREFIX/include" \
LDFLAGS="-L$PREFIX/lib" ./configure --prefix=$PREFIX