Undefined references when building GDAL with HDF5 with VCPKG

I’m trying to install GDAL with HDF5 support in a docker container. The build completes, but when I am building my executable, which links libgdal.a, I get the following undefined references in HDF5: 7): error: undefined reference to ‘H5Rdestroy’
external/gdal/lib/libhdf5_hl.a(H5DS.c.o):H5DS.c:function H5DSattach_scale:(.text+0xf1f): error: undefined reference to ‘H5Rdestroy’
external/gdal/lib/libhdf5_hl.a(H5DS.c.o):H5DS.c:function H5DSattach_scale:(.text+0x10fd): error: undefined reference to ‘H5Rcreate_object’
external/gdal/lib/libhdf5_hl.a(H5DS.c.o):H5DS.c:function H5DSattach_scale:(.text+0x1116): error: undefined reference to ‘H5Rcreate_object’
external/gdal/lib/libhdf5_hl.a(H5DS.c.o):H5DS.c:function H5DSattach_scale:(.text+0x122a): error: undefined reference to ‘H5Ropen_object’
external/gdal/lib/libhdf5_hl.a(H5DS.c.o):H5DS.c:function H5DSattach_scale:(.text+0x17b6): error: undefined reference to ‘H5Ropen_object’
external/gdal/lib/libhdf5_hl.a(H5DS.c.o):H5DS.c:function H5DSattach_scale:(.text+0x17d4): error: undefined reference to ‘H5Rcreate_object’
external/gdal/lib/libhdf5_hl.a(H5DS.c.o):H5DS.c:function H5DSattach_scale:(.text+0x1c50): error: undefined reference to ‘H5Rdestroy’
external/gdal/lib/libhdf5_hl.a(H5DS.c.o):H5DS.c:function H5DSdetach_scale:(.text+0x204a): error: undefined reference to ‘H5Ropen_object’
external/gdal/lib/libhdf5_hl.a(H5DS.c.o):H5DS.c:function H5DSdetach_scale:(.text+0x27d1): error: undefined reference to ‘H5Ropen_object’
external/gdal/lib/libhdf5_hl.a(H5DS.c.o):H5DS.c:function H5DSdetach_scale:(.text+0x27f1): error: undefined reference to ‘H5Rcreate_object’
external/gdal/lib/libhdf5_hl.a(H5LT.c.o):H5LT.c:function H5LT_dtype_to_text:(.text+0x2e94): error: undefined reference to ‘H5Tget_tag’
external/gdal/lib/libhdf5_hl.a(H5LTparse.c.o):H5LTparse.c:function H5LTyyparse:(.text+0xe1c): error: undefined reference to ‘H5Tset_tag’. Any help would be greatly appreciated!

  1. GDAL is using the dimension scales (DS) API. Ensure that your GDAL build is including the HDF5 high-level library (-lhdf5_hl), as well as the core library.

  2. Ensure that your HDF5 version meets the minimum version requirement for your GDAL version.

Oops, never mind about #1, you are already linking the high level library. I missed that on first reading.

Hi, @rob.thepvcman !

Would you please share your testing environment?

What’s your base Docker image (e.g., ubuntu-24.04)?
What’s the version of your vcpkg?

Finally, have you tried other package installation that depends on gdal[core,hdf5] and got the same error?
(e.g., vtk, mapnik, pdal, etc.)

I don’t see any issue with pdal using vcpkg-2025.03.19 on Ubuntu 24.04.
Here’s a GitHub Action result for verification:

test: pdal · hyoklee/actions@0ac610f

Regards,