Installing the library¶
This chapter describes the installation of h5cpp from sources. We discuss here the installation on a Linux (OSX should be quite similar). Installation on Windows is beyond this scope of this chapter and will be described in the advanced topics section of this manual.
Requirements¶
In order to build the code you need
a C++ compiler with reasonable C++11 support (gcc>=4.9,Micrsoft Developer Studio >= 2015)
the Boost libraries or a compiler with std::filesystem or std::experimental::filesystem
the HDF5 C library
googletest to build the unit tests
sphinx (with python) and doxygen for the documentation build
cmake >= 3.0
Getting the code¶
You can either obtain one of the release tar balls from the release site of the project on GitHub or clone the master branch of the repository. In the first case you get a source tree with
$ tar -xzf h5cpp-*.tar.gz
while in the latter case you may want to use
$ git clone https://github.com/ess-dmsc/h5cpp.git
In either case you end up with a directory h5cpp
in your current
directory.
Building and testing¶
h5cpp users cmake for building, thus, after unpacking or cloning the sources you should create a build directory
$ make h5cpp-build
$ cd h5cpp-build
and call cmake from there. In the simplest case just call
$ cmake -DCMAKE_BUILD_TYPE=Release ../h5cpp
which should do the job provided that all dependencies are installed in
standard locations. We strongly recommend to set the particular build
configuration with the CMAKE_BUILD_TYPE
variable.
To attempt to build without Boost, additionally specify -DWITH_BOOST=OFF. This requires a recent compiler, for example gcc >8, with filesystem in the std or std::experimental namespace.
On a Linux system the default build system used is make. Thus, in the build directory, just run make
$ make
and to build and run the unittests
$ make run_tests
Installation¶
A subsequent
$ make install
should finally install the code. The default installation prefix is
/usr/local
. If you want to change this set the
CMAKE_INSTALL_PREFIX
at the initial call to cmake to the
desired installation location.
Debian and Ubuntu users¶
As Debian and Ubuntu are closely related the installation is quite similar. The packages are provided by a special Debian repository. To work on the package sources you need to login as root user. Use su or sudo su on Debian and Ubuntu respectively. The first task is to add the GPG key of the HDRI repository to your local keyring
$ curl http://repos.pni-hdri.de/debian_repo.pub.gpg | apt-key add -
The return value of this command line should be OK.
In a next step you have to add new package sources to your system. For this
purpose go to /etc/apt/sources.list.d
and download the sources file.
For Debian (Buster) use
$ wget http://repos.pni-hdri.de/buster-pni-hdri.list
and for Ubuntu (Focal)
$ wget http://repos.pni-hdri.de/focal-pni-hdri.list
Similarly, proceed for Bullseye, Buster, Stretch, Groovy, Focal or Bionic. Once you have downloaded the file use
$ apt-get update
to update your package list and
$ apt-get install libh5cpp0.4.1 libh5cpp0.4.1-dbg libh5cpp0.4.1-doc libh5cpp0.4.1-dev
to install the library of v0.4.1. Dependencies will be resolved automatically so you can start with working right after the installation has finished.