A proper way to compile HDF5 plugins

Hello

I’m trying to setup programming enviornment. While compiling HDF5 library itself is not a problem at all, trying to compile a single plugin or all plugins (from plugin repo) gives me headaches. For me it feels like some parts of documentations in docs directory werent updated with changes done in CMake* files.

Building plugins with cmake . --preset ci-StdShar-GNUC runs just fine, but with following output:

-- HDF5 find comps: C;shared
-- Could NOT find HDF5 (missing: HDF5_DIR)
-- HDF5 C libs:0 static: and shared:
-- HDF5- found: INC=/usr/include/hdf5/serial TOOLS=/../bin

So, has HDF5 been found or not? It properly recognizes libhdf5-dev (development files package for ubuntu/debian), but I can’t force it to link with cloned hdf5 repo source code using enviornmental variables, various cmake settings or by editing existing cmake files.

Running make after this cmake stops at:

fatal error: hdf5.h: No such file or directory
   23 | #include "hdf5.h"
      |          ^~~~~~~~

OS: Ubuntu 23.10 on WSL, Windows 10

What should I do?

Usually, setting the HDF5_ROOT env var to the root of the HDF5 installation should work.
On my fedora I do:
export HDF5_ROOT=/temp/HDF_Group/HDF5/1.14.4; cmake --workflow --preset ci-StdShar-GNUC --fresh

Also, the find hdf5 macro will resort to fallback searches that may find an incompatible version.

I have managed to solve this issue. After hours of debugging CMake scripts it turns out all the necessary variables (including HDF5_INCLUDE_DIRS) are being processed correctly, but still missing in various places in a generated build.ninja file.

Switching from Ninja to “Unix Makefiles” solved this problem. I still have some linking problems, but this is already a huge step forward. Moving from WSL to Debian VM probably also helped.

After dealing with remaining linking problems, plugins compilation almost worked like a charm. This topic can be closed.