# A proper way to compile HDF5 plugins

**URL:** <https://forum.hdfgroup.org/t/a-proper-way-to-compile-hdf5-plugins/12303>\
**Category:** C++ Users' Group\
**Created:** [May 14, 2024, 12:26pm UTC](https://forum.hdfgroup.org/t/a-proper-way-to-compile-hdf5-plugins/12303 "2024-05-14T12:26:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![krzysztof.madura](https://forum.hdfgroup.org/user_avatar/forum.hdfgroup.org/krzysztof.madura/32/1964_2.png) [@krzysztof.madura](https://forum.hdfgroup.org/u/krzysztof.madura)\
**Post date:** [May 14, 2024, 12:26pm UTC](https://forum.hdfgroup.org/t/a-proper-way-to-compile-hdf5-plugins/12303/1 "2024-05-14T12:26:06Z")

</div>

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:

```auto
-- 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:

```auto
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?

---

<div class="post-metadata">

**Author:** ![byrn](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/b/85f322/32.png) [@byrn](https://forum.hdfgroup.org/u/byrn)\
**Post date:** [May 14, 2024, 3:03pm UTC](https://forum.hdfgroup.org/t/a-proper-way-to-compile-hdf5-plugins/12303/2 "2024-05-14T15:03:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![byrn](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/b/85f322/32.png) [@byrn](https://forum.hdfgroup.org/u/byrn)\
**Post date:** [May 14, 2024, 3:05pm UTC](https://forum.hdfgroup.org/t/a-proper-way-to-compile-hdf5-plugins/12303/3 "2024-05-14T15:05:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![krzysztof.madura](https://forum.hdfgroup.org/user_avatar/forum.hdfgroup.org/krzysztof.madura/32/1964_2.png) [@krzysztof.madura](https://forum.hdfgroup.org/u/krzysztof.madura)\
**Post date:** [May 17, 2024, 10:38am UTC](https://forum.hdfgroup.org/t/a-proper-way-to-compile-hdf5-plugins/12303/4 "2024-05-17T10:38:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![krzysztof.madura](https://forum.hdfgroup.org/user_avatar/forum.hdfgroup.org/krzysztof.madura/32/1964_2.png) [@krzysztof.madura](https://forum.hdfgroup.org/u/krzysztof.madura)\
**Post date:** [May 20, 2024, 11:37am UTC](https://forum.hdfgroup.org/t/a-proper-way-to-compile-hdf5-plugins/12303/5 "2024-05-20T11:37:08Z")

</div>

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