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
git diff > patch
patch
.
libMesh
makes extensive use of the standard C++ library
and increasing use of C++11 standard language and library features,
so you will need a recent, standards-compliant compiler. We have tried
very hard to make the code compiler-agnostic by avoiding questionable
constructs. If you have a C++11-supporting compiler that won't
build libMesh 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.
libMesh
Continuous Integration testing of all library
modifications currently is done with gcc 6.2 and gcc 7.3. Less
frequent testing is done with clang, Intel, and older gcc compilers.
libMesh
has many features which are enabled via
integration with various third-party
libraries, a few of which are redistributed in our contrib
directory, others of which may be separately installed on your system.
The libMesh configure script attempts to autodetect these libraries
when possible. Some of the supported libraries have occasionally
changing (or even frequently changing) APIs. We attempt to provide a
range of backwards compatibility for old versions of third-party APIs.
./configure make
./configure --help
Makefile
s 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
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.
GNU
Make
and a supported compiler,
as listed in the Compiler section. After the library
is configured simply type make
to build the library.
./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
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
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.
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
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.
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`
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