Installation Instructions

Getting the Software

The libMesh source can be downloaded from our GitHub release page. Stable releases are located there as compressed tar archives. You may also access the Git source tree for the latest code. You can get read-only access to the Git repository via:
git clone git://github.com/libMesh/libmesh.git 

If you would like to contribute to the project you will need a GitHub developer account, or you can contribute patches. To create a patch from a modified Git tree simply do:
git diff > patch 

in the top-level directory. You can then submit the file patch.

Compilers

libMesh makes extensive use of the standard C++ library, so you will need a decent, standards-compliant compiler. We have tried very hard to make the code completely compiler-agnostic by avoiding questionable (but legal) constructs. If you have a compiler that won't build the code please let us know. You will also need a decent C compiler if you want to build some of the contributed packages that add functionality to the library. The library is continuously tested with the following compilers:

Configuration

Configuring the library is straightforward. The GNU autoconf package is used to determine site-specific configuration parameters. A standard build will occur after typing
./configure
make

in the top-level project directory. To see all the configuration options type
./configure --help

The configure script will find your compilers and create Makefiles with the configuration specific for your site. If you want to use different compilers than those found by configure you can specify them in environment variables. For example, the following will build with the macports Clang compilers, and also specifies nonstandard search paths for a number of optional libraries:
./configure --prefix=/tmp/foo \
       --with-glpk-include=/opt/local/include \
       --with-glpk-lib=/opt/local/lib \
       --with-vtk-include=/opt/local/include/vtk-5.10 \
       --with-vtk-lib=/opt/local/lib/vtk-5.10 \
       --with-eigen-include=/opt/local/include/eigen3 \
       --with-cxx=clang++-mp-3.2 --with-cc=clang-mp-3.2 --disable-fortran

Note that the Fortran compiler is not actually used to compile any part of the library, but configure uses it to find out how to link Fortran libraries with C++ code, and it is possible to compile libMesh without a Fortran compiler.

Building the Library

To build the library you need GNU Make and a supported compiler, as listed in the Compiler section. After the library is configured simply type make to build the library.
The ./configure script distributed with the library looks at the shell environment variable METHODS to determine what modes the library should be built in. Valid values for METHOD are opt (optimized mode), dbg (build with debug symbols), and pro (build with profiling support for use with gprof). Once the library is configured you can build it simply by typing
make

Testing the Library

Running the Examples

libMesh includes a number of examples in the examples directory. From the top-level directory you can build and run the example programs by typing
make check

Note that many of the the example programs create output in the ExodusII format, since you can download Paraview for free, and it is a highly capable postprocessing tool. It is a simple matter to change the source in the example to write a different formats, however.

Unit Tests

The source tree contains a tests entry in the main trunk that contains a series of unit tests which can be used to validate a libMesh installation. These unit tests require CPPUnit to run properly. To run the unit test suite, from the build directory, simply do
make -C tests check 

Linking With Your Application

Since libMesh can be configured with many additional packages we recommend including the Make.common file created in the top-level directory in the Makefile of any application you want to use with the library. This will properly set the libmesh_INCLUDE and libmesh_LIBS variables, which you can append to with your own stuff.
For testing simple programs you may want to use the libmesh-config script included in the contrib/bin directory instead of creating a Makefile. This script may be used to determine the relevant compilation and linking flags used by libMesh. For example, you could build the application foo from foo.C like this:
 `libmesh-config --cxx` -o foo foo.C `libmesh-config --cxxflags --include --ldflags --libs`

Building on Windows

The libMesh library can be built on Microsoft Windows using the msys2 software distribution and the mingw-w64 compiler. There are, however, a few specifics that need to be taken into account.

After installing msys2 you need to install the mingw-w64 C++ compiler. To check that the installation was successfull, you can run

g++ --version

in the msys2 shell.

When you checkout the current version of libMesh using Git on Windows symlinks might not work. You can check whether your symlinks are set correctly by inspecting whether the README file points to the README.md file. If this is not the case, you should run the contrib/bin/fix_windows_symlinks.sh from within the git repository using the msys2 shell. This script removes all symlinks and copies the symlink targets to the corresponding places.

Not all optional dependencies are available on Windows. It is known that the following packages do not compile on Windows.

Hence, these libraries need to be deactivated, using the corresponding flags. For example by configuring libMesh with the following command.

./configure --prefix=c:/libmesh \
    --disable-metis \
    --with-fparser=none

Then, the library can be built and installed using:

make
make install