Manual installation¶
This section is a step-by-step guide for manual installation of the required build dependencies of HALMD. Be sure to check if your distribution ships with any of these packages before attempting to compile them yourself. Before proceeding, be aware of the section Automatic installation.
Tip
When installing third-party packages, it is advisable to put them into
separate directories. If you install software only for yourself, use package
directories of the form ~/opt/PKGNAME-PKGVERSION
, for example
~/opt/boost-1.65.0
or ~/opt/Sphinx-1.6.3
. If you install software
system-wide as the root user, use /opt/PKGNAME-PKGVERSION
.
This simple scheme allows you to have multiple versions of a package, or
remove a package without impacting others.
When initially creating the CMake build tree, include all third-party package
directories in the environment variable CMAKE_PREFIX_PATH
.
For example, if Boost and Lua are installed in your home directory,
CUDA is installed system-wide, and the HALMD source is in ~/projects/halmd
,
the initial cmake command might look like this
CMAKE_PREFIX_PATH=~/opt/boost_1_65_0:/opt/cuda-8.5:~/opt/lua-5.2.3 cmake ~/projects/halmd
Instead of setting CMAKE_PREFIX_PATH manually, you would include the package directories in your ~/.bashrc (or your favourite shell’s equivalent):
export CMAKE_PREFIX_PATH="${HOME}/opt/boost_1_65_0${CMAKE_PREFIX_PATH+:$CMAKE_PREFIX_PATH}"
export CMAKE_PREFIX_PATH="/opt/cuda-8.5${CMAKE_PREFIX_PATH+:$CMAKE_PREFIX_PATH}"
export CMAKE_PREFIX_PATH="${HOME}/opt/lua-5.2.3${CMAKE_PREFIX_PATH+:$CMAKE_PREFIX_PATH}"
GNU/Linux¶
CMake¶
The build process of HALMD depends on CMake, a cross-platform, open-source build system.
Get the latest CMake, currently CMake 3.5.2.
Extract the CMake source package, and prepare the CMake build with
./configure --prefix=$HOME/opt/cmake
Compile CMake with
make
Install CMake into your packages directory:
make install
Include CMake in your shell environment, by adding to ~/.bashrc:
export PATH="${HOME}/opt/cmake/bin${PATH+:$PATH}"
export MANPATH="${HOME}/opt/cmake/man${MANPATH+:$MANPATH}"
Boost C++ libraries¶
Get the latest Boost source package, currently Boost 1.72.0 (1.55.0 is the minimum required version, some unit tests will be disabled in Boost versions less than 1.59.0).
To build Boost, extract the source package and bootstrap the build with
./bootstrap.sh
Compile Boost using
./b2 cxxflags="-fPIC -std=c++11"
This compiles both dynamic and static libraries.
Note
By default, CMake uses the dynamically linked Boost libraries.
This is the recommended way of linking to Boost, as static linking of
the unit test executables significantly increases the size of the build
tree. If you wish to link statically nevertheless, for example to run a
program on another machine without your Boost libraries, invoke cmake
with -DBoost_USE_STATIC_LIBS=True
on the first run.
Warning
Boost may require more than fifteen minutes to compile.
You are strongly advised to take a coffee break.
Install the Boost libraries into your packages directory:
./b2 cxxflags="-fPIC -std=c++11" install --prefix=$HOME/opt/boost_1_72_0
Include Boost in your shell environment, by adding to ~/.bashrc:
export CMAKE_PREFIX_PATH="${HOME}/opt/boost_1_72_0${CMAKE_PREFIX_PATH+:$CMAKE_PREFIX_PATH}"
export LD_LIBRARY_PATH="${HOME}/opt/boost_1_72_0/lib${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}"
Lua interpreter¶
Get the latest Lua source package from the Lua download page, currently Lua 5.2.4.
Extract the Lua source package.
The recommended way of embedding the Lua intepreter in an executable is to link the Lua library statically, which is the default mode of compilation.
On 32-bit platforms, compile the Lua library with
make linux
On 64-bit platforms, include the -fPIC
flag using
make linux CFLAGS="-DLUA_USE_LINUX -fPIC -O2 -Wall"
Install the Lua library into your packages directory:
make install INSTALL_TOP=~/opt/lua-5.2.4
Include Lua in your shell environment, by adding to ~/.bashrc:
export CMAKE_PREFIX_PATH="${HOME}/opt/lua-5.2.4${CMAKE_PREFIX_PATH+:$CMAKE_PREFIX_PATH}"
export PATH="${HOME}/opt/lua-5.2.4/bin${PATH+:$PATH}"
export MANPATH="${HOME}/opt/lua-5.2.4/man${MANPATH+:$MANPATH}"
HDF5 library¶
Get the latest HDF5 source package, currently HDF5 1.10.0-patch1.
Prepare a statically linked build of the HDF5 C and C++ library with
CFLAGS=-fPIC CXXFLAGS=-fPIC ./configure --enable-cxx --enable-static --prefix=$HOME/opt/hdf5-1.10.0-patch1
Note
Compiling HDF5 with C++ support disables multi-threading.
Compile HDF5 using
make
Install the HDF5 libraries into your packages directory:
make install
Include HDF5 in your shell environment, by adding to ~/.bashrc:
export PATH="${HOME}/opt/hdf5-1.10.0-patch1/bin${PATH+:$PATH}"
export CMAKE_PREFIX_PATH="${HOME}/opt/hdf5-1.10.0-patch1${CMAKE_PREFIX_PATH+:$CMAKE_PREFIX_PATH}"
Sphinx documentation generator¶
Get the latest Sphinx source package, currently Sphinx 1.2.3.
Query your Python version
python -V
Create a package directory for Sphinx using the Python major and minor version (here 2.7)
mkdir -p $HOME/opt/Sphinx-1.2.3/lib/python2.7/site-packages
Add the package directory to the PYTHON_PATH environment variable
export PYTHONPATH="${HOME}/opt/Sphinx-1.2.3/lib/python2.7/site-packages${PYTHONPATH+:$PYTHONPATH}"
Install Sphinx into your packages directory
python setup.py install --prefix=$HOME/opt/Sphinx-1.2.3
Include Sphinx in your shell environment, by adding to ~/.bashrc:
export PATH="${HOME}/opt/Sphinx-1.2.3/bin${PATH+:$PATH}"
export PYTHONPATH="${HOME}/opt/Sphinx-1.2.3/lib/python2.7/site-packages${PYTHONPATH+:$PYTHONPATH}"