# Installing STEMsalabim¶

We recommend you download the latest stable release (3.1.3) from the Releases page <https://gitlab.com/STRL/STEMsalabim/tags>. If you want the latest features and/or bugfixes, you can also clone the repository using

$git clone https://gitlab.com/STRL/STEMsalabim.git$ git checkout devel # only if you want the devel code.


## Requirements¶

The following libraries and tools are needed to successfully compile the code:

The following libraries are optional and are needed only to enable additional features:

• libCurl (required for HTTP POST status announcements)

Note

You may find some of the requirements in the repositories of your Linux distribution, at least the compiler, CMake, libCurl and OpenMPI. On Debian or Ubuntu Linux, for example, you can simply run the following command to download and install all the requirements:

$apt-get install build-essential \ cmake \ libconfig++-dev \ libfftw3-dev \ libnetcdf-dev \ libcurl4-openssl-dev \ doxygen \ libopenmpi-dev \ openmpi-bin  Tip As the main work of the STEM image simulations is carried out by the FFTW3 library, you may reach best performance when you compile the library yourself with all available CPU level optimizations enabled. ## Building STEMsalabim¶ Extract the code archive to some folder on your hard drive, e.g. $ cd /tmp
$tar xzf stemsalabim-VERSION.tar.gz  Then, create a build directory and run CMake to generate the build configuration: $ mkdir /tmp/stemsalabim-build
$cd /tmp/stemsalabim-build$ cmake ../stemsalabim-VERSION


Please refer to the CMake documentation for instructions how to specify library paths and other environment variables, in case the above commands failed. When your libraries exist at non-standard places in your file system, you can specify the search paths as follows:

$cmake ../stemsalabim-VERSION \ -DFFTW_ROOT=/my/custom/fftw/ \ -DLIBCONFIG_ROOT=/my/custom/libconfig/ \ -DNETCDF_INCLUDE_DIR=/my/custom/netcdf/include \ -DCMAKE_INSTALL_PREFIX=/usr/local \ -DCMAKE_EXE_LINKER_FLAGS='-Wl,-rpath,/my/custom/lib64:/my/custom/lib' \ -DCMAKE_CXX_COMPILER=/usr/bin/g++  In the above example, some custom library paths are specified and the program’s run-time search path is modified. If cmake doesn’t detect the correct compiler automatically, you can specify it with -DCMAKE_CXX_COMPILER=. Having generated the necessary build files with CMake, simply compile the program using make and move it to the install location with make install: $ make -j8           # use 8 cores for compilation
\$ make install       # move the binaries and libraries to the INSTALL_PREFIX path