Clone wiki

mofem-joseph / General Installation


This page describes how to install MoFEM. The instructions in this section are for the most common cases and cover command line tools. If you have any problems, feedback or would like to suggest corrections, please email to

Out-of-Source Build

When your build generates files, they have to go somewhere. An in-source build puts them in your source tree. An out-of-source build puts them in a completely separate directory, so that your source tree is unchanged. In the first example, an in-place build is performed, i.e., the binaries are placed in the same directory as the source code.

Example in-source build (not recommended)

$ cd mofem
$ make && make install

In the second example, an out-of-place build is performed, i.e., the source code, libraries, and executables are produced in a directory separate from the source code directory(ies).

Example out-of-source build (Debug Version)

$ mkdir build_debug
$ cd build_debug
$ make && make install

Example out-of-source build (Release Version)

$ mkdir build_release
$ cd build_release
$ make && make install

Example for laptop (Release)

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_Fortran_COMPILER=/opt/local/bin/gfortran-mp-4.4 -DCMAKE_CXX_FLAGS="-lstdc++"  -DPETSC_DIR=/opt/build_for_gcc-mp-4.4/petsc-3.4.3 -DPETSC_ARCH=arch-darwin-c-opt -DMOAB_DIR=/opt/build_for_gcc-mp-4.4/local-moab-4.6.0/ -DCMAKE_INSTALL_PREFIX=$HOME/tmp/local   ../../mofem-bitbucket/mofem_v0.1/

Out-of-source builds are recommended, as you can build multiple variants in separate directories, e.g., MoFem_Debug (-DCMAKE_BUILD_TYPE=Debug), MoFEM_Release (-DCMAKE_BUILD_TYPE=Release). Note: Before performing an out-of-source build ensure that any possible CMake-generated in-source build information is removed from the source directory, e.g., CMakeFiles directory, and CMakeCache.txt.

Some build trees created with GNU autotools have a "make distclean" target that cleans the build and also removes Makefiles and other parts of the generated build system. CMake does not generate a "make distclean" target because CMakeLists.txt files can run scripts and arbitrary commands; CMake has no way of tracking exactly which files are generated as part of running CMake. Providing a distclean target would give users the false impression that it would work as expected. (CMake does generate a "make clean" target to remove files generated by the compiler and linker.)

A "make distclean" target is only necessary if the user performs an in-source build. CMake supports in-source builds, but we strongly encourage users to adopt the notion of an out-of-source build. Using a build tree that is separate from the source tree will prevent CMake from generating any files in the source tree. Because CMake does not change the source tree, there is no need for a distclean target. One can start a fresh build by deleting the build tree or creating a separate build tree.

You can find more here:

Doxygen documentation

The configuration file for Doxygen is located in the root source directory. To run the documentation simply run doxygen from the root source directory. The documentation can be accessed from the web browser, where index.html is located in: ($MOFEM_SOURCE_DIR/html/index.html)


To install MoFEM, you need 'CMake' and several third-party libraries.

  • CMake (>= 2.6)
  • petsc (>=petsc-3.3)
  • moab (>= 4.6.0)
  • boost (>= 1.53)

Configuration of PETSc and MOAB

PETSc config files examples

$ ./configure --with-debugging=0 --with-fortran=0 --with-cc=/opt/build_for_gcc-mp-4.4/local/bin/mpicc --with-cxx="/opt/build_for_gcc-mp-4.4/local/bin/mpicxx -lstdc++" --download-superlu_dist=1 --download-metis=1 --download-parmetis=1 -download-umfpack=1 --with-shared-libraries=0
$ ./configure --with-fc=mpif90 --with-cc=/opt/openmpi-1.6.3/bin/mpicc --with-cxx="/opt/openmpi-1.6.3/bin/mpicxx -lstdc++" --download-superlu_dist=1 --download-metis=1 --download-parmetis=1 --download-umfpack=1 --download-hypre=1 --with-mumps=1 --download-mumps=1 --with-scalapack=1 --download-scalapack=1 --with-blacs=1 --download-blacs=1 --download-spooles=1

MOAB config files examples

$ ./configure CC=/opt/build_for_gcc-mp-4.4/local/bin/mpicc CXX="/opt/build_for_gcc-mp-4.4/local/bin/mpicxx -lstdc++" --with-mpi=/opt/build_for_gcc-mp-4.4/local/ --with-parmetis=/opt/build_for_gcc-mp-4.4/petsc-3.1-p3/darwin10.2.0-c-debug/ --with-zoltan=/opt/build_for_gcc-mp-4.4/petsc-3.1-p3/darwin10.2.0-c-debug --with-hdf5=/opt/build_for_gcc-mp-4.4/local/ --with-netcdf=/opt/build_for_gcc-mp-4.4/local/ --prefix=/opt/build_for_gcc-mp-4.4/local-moab-4.6.0 --enable-debug --enable-mbzoltan --disable-fortran
$ ./configure --with-mpi --with-parmetis=/opt/petsc-3.1-p3/linux-gnu-c-debug --with-zoltan=/opt/petsc-3.1-p3/linux-gnu-c-debug --with-hdf5=/usr/lib --with-netcdf=/usr/lib --prefix=/opt/local-moab-4.6.0 --enable-debug --enable-mbzoltan

Back to Home Page