Error: Configure HDF5 - Ubuntu 18

I’m trying to install the HDF5 1.10.6 library in my Ubuntu 18 x64 machine.
I’m following the official HDF5 documentation to da that.

So, here is my configure error:

vm@vm:~/Desktop/hdf5-1.10.6$ sudo ./configure --prefix=/usr/local/hdf5
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
/home/vm/Desktop/hdf5-1.10.6/bin/missing: line 3: $'\r': command not found
/home/vm/Desktop/hdf5-1.10.6/bin/missing: line 5: $'\r': command not found
/home/vm/Desktop/hdf5-1.10.6/bin/missing: line 8: $'\r': command not found
/home/vm/Desktop/hdf5-1.10.6/bin/missing: line 13: $'\r': command not found
/home/vm/Desktop/hdf5-1.10.6/bin/missing: line 18: $'\r': command not found
/home/vm/Desktop/hdf5-1.10.6/bin/missing: line 21: $'\r': command not found
/home/vm/Desktop/hdf5-1.10.6/bin/missing: line 26: $'\r': command not found
/home/vm/Desktop/hdf5-1.10.6/bin/missing: line 32: syntax error near unexpected token `$'in\r''
'home/vm/Desktop/hdf5-1.10.6/bin/missing: line 32: `case $1 in
configure: WARNING: 'missing' script is too old or missing
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking whether to enable maintainer-specific portions of Makefiles... no
configure: error: cannot run /bin/bash bin/config.sub

How can I fix it?

My setup is:
OS: Ubuntu 18 x64
HDF5 library: 1.10.6
CMake version: 3.10.2
gcc version: 7.4.0

Follow the instruction in H5CPP/INSTALL Some of these libraries are H5CPP and you won’t make use of them if you are not into machine learning and fast IO. Anyhoo here is a copy paste:

sudo apt-get install -y build-essential fakeroot devscripts google-perftools kcachegrind doxygen doxygen-gui markdown libboost-program-options-dev libgtest-dev cmake gcc g++
sudo apt-get install -y libarmadillo-dev libitpp-dev libblitz0-dev  libeigen3-dev libdlib-dev

Then proceed with configure and make:

./configure --prefix=/usr/local --enable-build-mode=production --enable-shared --enable-static --enable-optimization=high --with-default-api-version=v110
make -j4
sudo make install

best: steve

Thank you @steven ,

I will not use Machine Learning and Fast IO.
Should I install all these listed dependencies to use H5CPP?

I just want to be possible read and write HDF5 files from my C++ application.
I would like to link the H5CPP statically and use OpenMP some times…

Do I need all these dependencies?

Sorry @steven about these questions, but I have another one:

In the H5CPP CMakeLlist.txt the default HDF5 directory path is:

set(HDF5_ROOT /usr/local/ /usr) 

What I did:

  1. Download the HDF5 1.10.6 (CMake version) from official HDF Group site
  2. Use CMake to build the HDF5. cmake .. make and sudo make install
  3. The result of this process is a generated folder called HDF5-1.10.6-Linux inside the build folder (not in the system /usr/ or /usr/local/)
  4. This HDF5-1.10.6-Linux folder have this folder structure inside of it:
  • HDF5-1.10.6
    –> HDF_GROUP
    ---->HDF5
    ------> 1.10.6
    --------> bin
    --------> include
    --------> lib
    --------> share

So, what I did.
1- I remove all old versions of HDF5 library of my machine: sudo apt remove libhdf5*
2- I manually create folders and copy each folder content to the correspondent folder inside the /usr/
Example:
/usr/include/HDF5/ -> Here I paste the content of the generated HDF5 include folder
3- I installed all dependencies listed below:

sudo apt-get install -y build-essential fakeroot devscripts google-perftools kcachegrind doxygen doxygen-gui markdown libboost-program-options-dev libgtest-dev cmake gcc g++
sudo apt-get install -y libarmadillo-dev libitpp-dev libblitz0-dev  libeigen3-dev libdlib-dev

Obs.: The only dependency that gives me a error is that:

Package libblitz0-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

4- Now I tried again to configure the H5CPP using:

./configure --prefix=/usr/local --enable-build-mode=production --enable-shared --enable-static --enable-optimization=high --with-default-api-version=v110

But I still get this CMake error:

-- !!! H5CPP examples require of HDF5 v1.10.4 or greater!!!

Could you help me a little bit more?

Here is the minimal setup for Ubuntu 18.04. I am still checking out the examples, which you find at the bottom. I’ve checked these steps on a fresh official ubuntu 18.04 AWS EC2 image: ami-046842448f9e74e7d

sudo apt update && sudo apt upgrade
sudo apt install build-essential g++ gcc cmake zlib1g-dev pkg-config

HDF5 CAPI by The HDFGroup compiled for H5CPP:

wget http://h5cpp.org/download/hdf5-1.10.6.tar.gz
tar -xvzf hdf5-1.10.6.tar.gz && cd hdf5-1.10.6/
./configure --prefix=/usr/local --enable-build-mode=production
make -j4 && sudo make install

H5CPP headers

wget http://h5cpp.org/download/h5cpp-dev_1.10.4-5_amd64.deb
sudo dpkg -i h5cpp-dev_1.10.4-5_amd64.deb

H5CPP compiler – required for compiler assisted reflection

wget http://h5cpp.org/download/h5cpp_1.10.4-5_amd64.deb
sudo apt install libllvm6.0 libclang-common-6.0-dev
sudo dpkg -i h5cpp_1.10.4-5_amd64.deb

cleanup: cd ~/ && rm -rf h5cpp* hdf5*

To run examples:

sudo apt install libarmadillo-dev
cp -R /usr/share/h5cpp/ ./ && cd h5cpp/examples

use the unix make as there seem to be some glitches with cmake
best:
steve

Thank you again @steven
I did this process above and I got no errors in the entire process.

Finally, I’m trying to compile some examples. Here is the basic example try:

vm@vm:~/Desktop/h5cpp/examples/basics$ ls
basics.cpp  Makefile
vm@vm:~/Desktop/h5cpp/examples/basics$ make
g++ -std=c++17 -Wno-deprecated   -c -o basics.o basics.cpp
In file included from basics.cpp:1:0:
/usr/local/include/h5cpp/all:8:11: fatal error: core: No such file or directory
  #include "core"
           ^~~~~~
compilation terminated. 

2 questions:
1- What should I do to compile this basic example?
2- After remove all old HDF5 installed libraries (described above) and do your Ubuntu 18 minimal setup above, I type:
apt list --installed |grep hdf5 in the terminal and I got this output below:

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

hdf5-helpers/bionic,now 1.10.0-patch1+docs-4 amd64 [installed,automatic]
libhdf5-100/bionic,now 1.10.0-patch1+docs-4 amd64 [installed,automatic]
libhdf5-cpp-100/bionic,now 1.10.0-patch1+docs-4 amd64 [installed,automatic]
libhdf5-dev/bionic,now 1.10.0-patch1+docs-4 amd64 [installed,automatic]

Version 1.10.0? Should be 1.10.6, right?

On a pristine environment I built for you I got:

cp -R /usr/share/h5cpp/ ./ && cd h5cpp/examples/basic && make
g++ -std=c++17 -Wno-deprecated   -c -o basics.o basics.cpp
g++ basics.o -lhdf5  -lz -ldl -lm -o basics
int
data type: int value valid
THIS ERROR is on PURPOSE: /usr/include/h5cpp/H5Pall.hpp line#  68 : failed to parse arguments...
#h5dump -pH 004.h5
  1. you should install the header libraries: please find out if the content /usr/include/h5cpp matches with github h5cpp header files. If for some reasons it doesn’t match, please manually copy them. Also be certain the /usr/local/include/h5cpp is removed when using the ubuntu packaged version.
  2. I didn’t tell you how to remove all libhdf5 from ubuntu, but outlined how to cleanup the $HOMEDIR after installing libhdf5. I don’t see how apt list could detect a manually installed libhdf5 you should see the correctly installed in /usr/local/lib/, you must include and link lhdf5 >= 1.10.4 as H5CPP does rely on direct chunk IO introduced in this revision. If you followed my instructions you have this version installed in /usr/local/include and /usr/local/lib.

Keep in mind that Ubuntu 18.04 ships various versions of libhdf5 what you see there is the libraries installed with your system. The newest debian will ship the correct hdf5 libraries as well as H5CPP.

to check libhdf5 version: cat /usr/local/lib/libhdf5.settings |grep Version
should print out: HDF5 Version: 1.10.6

errata: I just discovered that cmake breaks with multi-tu example; just use unix make on the examples for now until I upload the fixed packages.
best: steve

1 Like

Perfect! Now all is working good!

The final key change was delete the /usr/local/include/h5cpp folder.

Thank you so much for your commitment to help me.

1 Like