#1052250 pkg-config file incorrect for static linking

Package:
libhdf5-dev
Source:
libhdf5-dev
Description:
HDF5 - development files - serial version
Submitter:
Sébastien Villemot
Date:
2025-05-07 11:57:01 UTC
Severity:
normal
#1052250#5
Date:
2023-09-19 13:19:42 UTC
From:
To:
Dear Maintainer,

Trying to statically link an executable (like h5_write.c¹) against HDF5 using
the pkg-config profile fails:

$ gcc -static h5_write.c $(pkg-config --cflags hdf5) $(pkg-config --static --libs hdf5)

/usr/bin/ld: /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.a(H5PLint.o): in function `H5PL__open':
(.text+0x46b): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.a(H5Fint.o): in function `H5F_track_metadata_read_retries':
(.text+0x3c09): undefined reference to `log10'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.a(H5Fint.o): in function `H5F_set_retries':
(.text+0x3d42): undefined reference to `log10'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.a(H5Tconv.o): in function `H5T__conv_f_i':
(.text+0x631a4): undefined reference to `pow'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.a(H5Tconv.o): in function `H5T__conv_i_f':
(.text+0x64a73): undefined reference to `pow'
/usr/bin/ld: (.text+0x64d82): undefined reference to `pow'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.a(H5Z.o): in function `H5Z__init_package':
(.text+0x60b): undefined reference to `SZ_encoder_enabled'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.a(H5Zdeflate.o): in function `H5Z__filter_deflate':
(.text+0x114): undefined reference to `compress2'
/usr/bin/ld: (.text+0x212): undefined reference to `inflateInit_'
/usr/bin/ld: (.text+0x23d): undefined reference to `inflate'
/usr/bin/ld: (.text+0x25e): undefined reference to `inflateEnd'
/usr/bin/ld: (.text+0x2b4): undefined reference to `inflateEnd'
/usr/bin/ld: (.text+0x33e): undefined reference to `inflateEnd'
[…]

Obviously the libraries on which HDF5 depends should be added to the
Libs.private and Requires.private fields.²

Thanks for your work,

¹ https://raw.githubusercontent.com/HDFGroup/hdf5/develop/examples/h5_write.c
² See for example https://people.freedesktop.org/~dbn/pkg-config-guide.html

#1052250#10
Date:
2024-12-30 19:11:00 UTC
From:
To:
Hi,

Le 2023-09-19 15:19, Sébastien Villemot a écrit :
pkg-config for HDF5 in Debian were added by me, and are just minimalist
ones. They are not expected to work for every use case.

I've opened a feature request at the upstream github project:
https://github.com/HDFGroup/hdf5/issues/5194

Meanwhile, patches are welcome.

Best,
_g.

#1052250#15
Date:
2025-05-07 11:54:29 UTC
From:
To:
Le lundi 30 décembre 2024 à 20:11 +0100, pini@debian.org a écrit :

[…]

Thanks. So if I understand correctly upstream’s reply, the proper fix
for this issue is to switch to a cmake build for the Debian package
(and this will become mandatory for HDF5 2.0).