See download and install page for general requirements and the download of the last stable version of GetFEM++.
There are two ways to get GetFEM++, either as a compressed package for the stable release (file getfem-5.3.tar.gz downloadable on the page download and install) or via anonymous git access (current unstable version under development).
You can get the last stable version directly with
download package:
$ wget http://download-mirror.savannah.gnu.org/releases/getfem/stable/getfem-5.3.tar.gz
unpack:
$ tar xzf getfem-5.3.tar.gz
and go to the root directory of GetFEM++:
$ cd getfem-5.3/
The current git version is:
checkout over GIT protocol:
$ git clone https://git.savannah.nongnu.org/git/getfem.git
go to the root directory of GetFEM++:
$ cd getfem
and run autogen.sh script (you need m4, automake and libtool)
$ bash autogen.sh
Configure with:
$ ./configure
then start the compilation with:
$ make
and finally install with:
$ make install
You can find some additional help on how to build the Matlab interface on Ubuntu on the page of Mirko Windhoff.
If you want to use a different compiler than the one chosen automatically by the ./configure script, just specify its name on the command line:
$ ./configure CXX=mycompiler
If you want to build one of the interfaces, use:
$ ./configure ``--enable-python``
$ ./configure ``--enable-scilab``
$ ./configure ``--enable-matlab``
depending on the interface you want to build. Note that the python interface is build by default.
If you want to use a specific BLAS library, you may have to supply the necessary link flags and libs to the configure script with:
$ ./configure BLAS_LIBS="-L/path/to/lib -lfoo -lbar ....etc"
for example:
$ ./configure BLAS_LIBS="-L/usr/lib/sse2/atlas -lblas"
If you want to set the prefix directory where to install the library you can use the --prefix option (the default prefix directory is /usr/local):
$ ./configure --prefix=my_dest_dir
By default, the python interface is built and for python 2 version. You can disable the built of the python interface with:
$ ./configure --disable-python
or either build the interface for python 3 version with
$ ./configure –enable-python3
Note that there are other options to the configure script. A ./configure --help will list them.
Warning
The installation of the SciLab GetFEM++ toolbox can be somewhat tricky, since it combines a C++ compiler, libraries and SciLab interaction. In case of troubles with a non-GNU compiler, gcc/g++ (>= 4.8) should be a safe solution.
Caution
You may also use --with-scilab-toolbox-dir=toolbox_dir to change the default toolbox installation directory (gfdest_dir/getfem_toolbox). Use ./configure --help for more options.
With this, since the Scilab interface is contained into the GetFEM++ sources (in the directory interface/src) you can compile both the GetFEM++ library and the Scilab interface by
make
Optionally, you can install it with
make install
If you want to use a different compiler than the one chosen automatically by the ./configure script, just specify its name on the command line: ./configure CXX=mycompiler.
Once getfem is compiled:
- Go to the scilab getfem++ interface install directory (interface/src/scilab if the installation is not done)
- launch scilab
- load the getfem++ toolbox with: exec loader.sce;
- You can try to launch a demo with: cd demos; exec demo_static_contact.sce;
The installation of the getfem-interface toolbox can be somewhat tricky, since it combines a C++ compiler, libraries and MatLab interaction... In case of troubles with a non-GNU compiler, gcc/g++ (>= 4.8) should be a safe solution.
Caution
You may also use --with-matlab-toolbox-dir=toolbox_dir to change the default toolbox installation directory (gfdest_dir/getfem_toolbox). Use ./configure --help for more options.
With this, since the Matlab interface is contained into the GetFEM++ sources (in the directory interface/src) you can compile both the GetFEM++ library and the Matlab interface by
make
An optional step is make check in order to check the matlab interface (this sets some environment variables and runs the check_all.m script which is the tests/matlab directory of the distribution) and install it (the libraries will be copied in gfdest_dir/lib, while the MEX-File and M-Files will be copied in toolbox_dir):
make install
If you want to use a different compiler than the one chosen automatically by the ./configure script, just specify its name on the command line: ./configure CXX=mycompiler.
When the library is installed, you may have to set the LD_LIBRARY_PATH environment variable to the directory containing the libgetfem.so and libgetfemint.so, which is gfdest_dir/lib:
export LD_LIBRARY_PATH=gfdest_dir/lib # if you use bash
The last step is to add the path to the toolbox in the matlab path:
A very classical problem at this step is the incompatibility of the C and C++ libraries used by Matlab. Matlab is distributed with its own libc and libstdc++ libraries. An error message of the following type occurs when one tries to use a command of the interface:
/usr/local/matlab14-SP3/bin/glnxa64/../../sys/os/??/libgcc_s.so.1:
version `GCC_?.?' not found (required by .../gf_matlab.mex??).
In order to fix this problem one has to enforce Matlab to load the C and C++ libraries of the system. There is two possibilities to do this. The most radical is to delete the C and C++ libraries distributed along with Matlab (if you have administrator privileges ...!) for instance with:
mv /usr/local/matlab14-SP3/sys/os/??/libgcc_s.so.1 libgcc_s.so.1_old
mv /usr/local/matlab14-SP3/sys/os/??/libstdc++_s.so.6 libstdc++_s.so.6_old
mv /usr/local/matlab14-SP3/sys/os/??/libgfortran.so.3 libgfortran.so.3_old
The second possibility is to set the variable LDPRELOAD before launching Matlab for instance with (depending on the system):
LD_PRELOAD=/usr/lib/libgcc_s.so:/usr/lib/libstdc++.so.6 matlab
More specific instructions can be found in the README* files of the distribution.
A few precompiled versions of the Matlab interface are available on the download and install page of GetFEM++.
A second problem arising with recent distribution of Matlab (2016a), is the incompatibility of some libraries with ILP64 version of MKL loaded by MATLAB which uses 64 bits integers instead of 32 bits ones contrarily to most system blas/lapack libraries. New releases of GetFEM++ are compatible with both 64 bits and 32 bits integer blas/lapack libraries. However, for instance, Mumps should be recompiled in a 64 bit integer version to be compatible with MKL ILP64. Mumps version on the system is the 32 bits integer version. If problem of this kind are encountered, you can try to force Matlab to load 32 bit blas and lapack libraries with:
LD_PRELOAD=/usr/lib/libblas.so:/usr/lib/liblapack.so matlab