From The FEniCS project
This aims to be a more complete, fully from source, guide to installing DOLFIN and its dependencies.
It is designed for slightly older GNU/Linux systems, where even the presence of a recent Python, for instance, is not guaranteed. It has been tested on RedHat Enterprise Linux 4 and Ubuntu 8.04. You can also fetch this information in a more ready-to-use manner in the form of a bash script, from [1].
Note that the following list exceeds the minimum number of packages needed to compile DOLFIN. SyFi (and its dependencies GiNaC and CLN) are not part of DOLFIN at all, while PETSc, SLEPc, gts, and SuiteSparse are optional dependencies for DOLFIN. Swig is only needed when the Python interface for DOLFIN is enabled. FErari is also optional.
Requirements
libtool, libxml2, pkg-config, LAPACK, BLAS and a C++ compiler. These should already be included in any standard Linux distribution.
Basic notes
The build instructions on this page incorporate the use of the following environment variables:
# modify the following to fit your needs... # Where do you want the downloaded source files to go? export DOWNLOAD_PATH=$HOME/download/src # Where do you want the downloaded FENICS files to go? export FENICS_PATH=$HOME/fenics # Where do you want the compiled software installed? export INSTALL_PATH=$HOME/build # Where are your LAPACK and BLAS libraries? export LAPACKANDBLAS=/usr/lib/atlas # Where is BOOST installed? export BOOST_DIR=$INSTALL_PATH/include/BOOST_install # Where is UMFPACK? export UMFPACK_DIR=/usr/include/suitesparse # What sort of PETSc build do you need? export PETSC_ARCH=linux-gnu-cxx-opt # Where is PETSc? export PETSC_DIR=$DOWNLOAD_PATH/petsc-3.0.0-p8 # What sort of SLEPc build do you need? export SLEPC_ARCH=linux-gnu-cxx-opt # Where is SLEPc? export SLEPC_DIR=$DOWNLOAD_PATH/slepc-3.0.0-p6
# Other interesting environment variables (some of this may change for you) export PYTHON=$INSTALL_PATH/bin export PATH=$VTK_DIR/bin:$INSTALL_PATH/share/swig:$HOME/bin:$INSTALL_PATH/bin:$PATH export LD_LIBRARY_PATH=$BOOST_DIR/lib:$INSTALL_PATH/lib:$INSTALL_PATH/lib/vtk-5.5:$LD_LIBRARY_PATH export PYTHONPATH=$HOME/lib/python:$INSTALL_PATH/lib/python2.6/site-packages export DOLF=$FENICS_PATH/dolfin export PKG_CONFIG_PATH=$DOLF/scons/pkgconfig:/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/share/pkgconfig:$INSTALL_PATH/lib/pkgconfig:$PKG_CONFIG_PATH # some others... export VTK_DATA_ROOT=$DOWNLOAD_PATH/VTKData export MANPATH=$HOME/share/man:$INSTALL_PATH/man:$INSTALL_PATH/share/man:$MANPATH
You also need to create the following directories
mkdir -p $FENICS_PATH mkdir -p $INSTALL_PATH
Building the dependencies
Note that older versions of Boost might not work. In the case of RedHat 4, you need to uninstall it using
rpm -e boost
Building Python 2.6
cd $DOWNLOAD_PATH # you need at least version 2.6.2 # Note: make sure to get everything: the libraries, executables, etc... # the binaries are NOT enough! wget http://python.org/ftp/python/2.6.2/Python-2.6.2.tar.bz2 tar -xjf Python-2.6.2.tar.bz2 cd Python-2.6.2 ./configure --prefix=$INSTALL_PATH make make install
Building Nose Testing 0.11 for Python
cd $DOWNLOAD_PATH # you need at least version 0.11 wget http://somethingaboutorange.com/mrl/projects/nose/nose-0.11.1.tar.gz tar -xzf nose-0.11.1.tar.gz cd nose-0.11.1 python setup.py install --prefix=$INSTALL_PATH
Building Mercurial 1.3
cd $DOWNLOAD_PATH wget http://www.selenic.com/mercurial/release/mercurial-1.3.tar.gz tar -xzf mercurial-1.3.tar.gz cd mercurial-1.3
# now build it make install-home # you can test it by running hg debuginstall
Building SCons 1.2.0
cd $DOWNLOAD_PATH wget http://internap.dl.sourceforge.net/sourceforge/scons/scons-1.2.0.tar.gz tar -xzf scons-1.2.0.tar.gz cd scons-1.2.0 python setup.py install --prefix=$INSTALL_PATH
Building NumPy 1.3.0
# make sure `LAPACKANDBLAS' is set properly cd $DOWNLOAD_PATH # Make sure to get the most recent version wget http://internap.dl.sourceforge.net/sourceforge/numpy/numpy-1.3.0.tar.gz tar -xzf numpy-1.3.0.tar.gz cd numpy-1.3.0 echo "[atlas]" > site.cfg echo "library_dirs = $LAPACKANDBLAS" >> site.cfg echo "atlas_libs = lapack, blas" >> site.cfg python setup.py install --prefix=$INSTALL_PATH
# can test it with python -c 'import numpy; numpy.test()'
Building Boost 1.39.0
cd $DOWNLOAD_PATH # you MUST have at least version 1.33.0 wget http://internap.dl.sourceforge.net/sourceforge/boost/boost_1_39_0.tar.bz2 tar -xjf boost_1_39_0.tar.bz2 cd boost_1_39_0 # there is some minor compiling # you can run `./bootstrap.sh --help' to see the options # anyway, configure with the `program_options' and `filesystem' libraries ./bootstrap.sh --with-libraries=program_options,filesystem --prefix=$BOOST_DIR --libdir=$BOOST_DIR/lib # then compile and install (may take a few minutes) ./bjam --layout=system install
Building Swig 1.3.39
cd $DOWNLOAD_PATH # you MUST have the most recent version (at least 1.3.36)! Required for `instant' to work properly. wget http://voxel.dl.sourceforge.net/sourceforge/swig/swig-1.3.39.tar.gz tar -xzf swig-1.3.39.tar.gz cd swig-1.3.39 ./configure --prefix=$INSTALL_PATH make make install
make check-python-examples make check-python-test-suite
Building Open MPI 1.3.3
cd $DOWNLOAD_PATH # Make sure to get the most recent version wget http://www.open-mpi.org/software/ompi/v1.3/downloads/openmpi-1.3.3.tar.bz2 tar -xjf openmpi-1.3.3.tar.bz2 cd openmpi-1.3.3 # NOTE: if you are installing a new version, make sure to clean and # fully uninstall the previous version! # configuring takes about 5~8 minutes ./configure --prefix=$INSTALL_PATH # making takes about 10~12 minutes make all # installing takes about 3 minutes make install
# can run the following to check the installation ompi_info
Building PETSc 3.0.0-p8
cd $DOWNLOAD_PATH # Make sure to get the most recent version wget ftp://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.0.0-p8.tar.gz tar -xzf petsc-3.0.0-p8.tar.gz cd petsc-3.0.0-p8 export PETSC_DIR=$PWD # configuring will take about 15 mins # ./config/configure.py --with-mpi-dir=$INSTALL_PATH --with-clanguage=c++ --download-hypre=1 --with-hypre=1 --with-shared=1 ./config/configure.py --with-mpi-dir=$INSTALL_PATH --with-umfpack=1 --download-umfpack=1 --with-clanguage=c++ --with-shared=1 # making will take about 30~40 mins make all
make test
Building SLEPc 3.0.0-p6
cd $DOWNLOAD_PATH # Make sure to get the most recent version wget http://www.grycap.upv.es/slepc/download/distrib/slepc-3.0.0-p6.tgz tar -xzf slepc-3.0.0-p6.tgz cd slepc-3.0.0-p6 export SLEPC_DIR=$PWD ./config/configure.py # making will take about 5~10 mins make all
make test
Building gts 0.7.6
cd $DOWNLOAD_PATH # Make sure to get the most recent version wget http://internap.dl.sourceforge.net/sourceforge/gts/gts-0.7.6.tar.gz tar -xzf gts-0.7.6.tar.gz cd gts-0.7.6 ./configure --prefix=$INSTALL_PATH make make install
Building CLN 1.2.2
cd $DOWNLOAD_PATH wget http://www.ginac.de/CLN/cln-1.2.2.tar.bz2 tar -xjf cln-1.2.2.tar.bz2 cd cln-1.2.2 ./configure --prefix=$INSTALL_PATH make make install
Building GiNaC 1.5.2
cd $DOWNLOAD_PATH wget http://www.ginac.de/ginac-1.5.2.tar.bz2 tar -xjf ginac-1.5.2.tar.bz2 cd ginac-1.5.2 ./configure --prefix=$INSTALL_PATH make make install
Building SuiteSparse 3.4 (with metis 4.0)
cd $DOWNLOAD_PATH wget http://www.cise.ufl.edu/research/sparse/SuiteSparse/SuiteSparse-3.4.0.tar.gz tar -xzf SuiteSparse-3.4.0.tar.gz cd SuiteSparse export UMFPACK_DIR=$PWD wget http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-4.0.tar.gz tar -xzf metis-4.0.tar.gz cd metis-4.0 make cd .. make
Building VTK+ 5.x
First, get the latest version of `Cmake' and make sure it is in the path. Personally, I just got the binary files and copied them directly into my "$INSTALL_PATH" directory.
Next, get the VTK source files. If you have CVS on your LINUX system, then you can do the following. Make sure to run these commands inside your "$DOWNLOAD_PATH" directory:
# Anonymous User Read-Only Access # You can obtain read-only access to the CVS repository as follows. cvs -d :pserver:anonymous@public.kitware.com:/cvsroot/VTK login #(respond with password vtk) # Follow the above command by checking out the source code: cvs -d :pserver:anonymous@public.kitware.com:/cvsroot/VTK checkout VTK # this will take about 5+ minutes
This CVS tree is VTK 5.x. Execute the CVS checkout in a clean directory. It will create a VTK directory, overwriting any existing VTK tree. CMake is required for building.
For testing purposes you might wish to checkout the CVS VTKData:
cvs -d :pserver:anonymous@public.kitware.com:/cvsroot/VTKData login #(respond with password vtk) # Follow the above command by checking out the data: cvs -d :pserver:anonymous@public.kitware.com:/cvsroot/VTKData checkout VTKData # this will take about 1 minute
Next, we need to generate a temporary build directory. Also see the README.html page that is in the VTK+ sub-directory. Create a sub-directory of "$DOWNLOAD_PATH" that looks like:
$DOWNLOAD_PATH/VTK-build
Change into that directory. And run:
ccmake $DOWNLOAD_PATH/VTK # make sure ccmake is in your directory path (i.e. the PATH environment variable)
You will then have a console where you can configure stuff. For example, you could set:
BUILD_EXAMPLES ON BUILD_SHARED_LIBS ON BUILD_TESTING ON CMAKE_BACKWARDS_COMPATIBILITY 2.4 CMAKE_BUILD_TYPE CMAKE_INSTALL_PREFIX `$INSTALL_PATH' <--- replace $INSTALL_PATH by the actual path!!! DESIRED_QT_VERSION 0 VTK_DATA_ROOT `$HOME'/src/VTKData <--- replace $HOME by the actual path!!! VTK_LARGE_DATA_ROOT VTK_LARGE_DATA_ROOT-NOTFOUND VTK_USE_GEOVIS ON VTK_USE_INFOVIS ON VTK_USE_N_WAY_ARRAYS ON VTK_USE_PARALLEL ON VTK_USE_QT OFF VTK_USE_RENDERING ON VTK_USE_TEXT_ANALYSIS OFF VTK_USE_VIEWS ON VTK_WRAP_JAVA OFF VTK_WRAP_PYTHON ON VTK_WRAP_TCL ON
Once that is set, press `c' to configure. Then press `g' to generate. This will put you back at the prompt in the `VTK-build' sub-directory. Next, compile by running:
make # wait 1+ hour # Then run make install
Building portions of the FEniCS project
Building FIAT
cd $FENICS_PATH hg clone http://www.fenics.org/hg/fiat cd fiat python setup.py install --prefix=$INSTALL_PATH
Building FErari
cd $FENICS_PATH hg clone http://www.fenics.org/hg/ferari cd ferari python setup.py install --prefix=$INSTALL_PATH
Building UFC
cd $FENICS_PATH hg clone http://www.fenics.org/hg/ufc cd ufc # must be built with SCons scons # now install it scons install prefix=$INSTALL_PATH
Building UFL
cd $FENICS_PATH hg clone http://www.fenics.org/hg/ufl cd ufl python setup.py install --prefix=$INSTALL_PATH
Building FFC
cd $FENICS_PATH hg clone http://www.fenics.org/hg/ffc cd ffc python setup.py install --prefix=$INSTALL_PATH
Building SyFi
cd $FENICS_PATH hg clone http://www.fenics.org/hg/syfi cd syfi/ ./configure --prefix=$INSTALL_PATH make all make install
Building Viper
# requires VTK cd $FENICS_PATH hg clone http://www.fenics.org/hg/viper cd viper python setup.py install --prefix=$INSTALL_PATH
Building Instant
cd $FENICS_PATH # Make sure you have the most recent version of SWIG installed hg clone http://www.fenics.org/hg/instant cd instant python setup.py install --prefix=$INSTALL_PATH
Building DOLFIN
cd $FENICS_PATH hg clone http://www.fenics.org/hg/dolfin cd dolfin # configure scons configure prefix=$INSTALL_PATH withBoostDir=$BOOST_DIR withUmfpackDir=$UMFPACK_DIR withPetscDir=$PETSC_DIR withSlepcDir=$SLEPC_DIR enableDemos=yes enableScotch=no enableTrilinos=no enableMpi=no enablePetsc=yes enableSlepc=yes enableUmfpack=yes enableParmetis=no enableMtl4=no enableDebug=yes enablePython=yes # compile scons # then install scons install

