# Undefined references when building GDAL with HDF5 with VCPKG

**URL:** <https://forum.hdfgroup.org/t/undefined-references-when-building-gdal-with-hdf5-with-vcpkg/13152>\
**Category:** C++ Users' Group\
**Created:** [April 3, 2025, 7:30pm UTC](https://forum.hdfgroup.org/t/undefined-references-when-building-gdal-with-hdf5-with-vcpkg/13152 "2025-04-03T19:30:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rob.thepvcman](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/r/dfb087/32.png) [@rob.thepvcman](https://forum.hdfgroup.org/u/rob.thepvcman)\
**Post date:** [April 3, 2025, 7:30pm UTC](https://forum.hdfgroup.org/t/undefined-references-when-building-gdal-with-hdf5-with-vcpkg/13152/1 "2025-04-03T19:30:11Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![dave.allured](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/d/8e8cbc/32.png) [@dave.allured](https://forum.hdfgroup.org/u/dave.allured)\
**Post date:** [April 3, 2025, 8:54pm UTC](https://forum.hdfgroup.org/t/undefined-references-when-building-gdal-with-hdf5-with-vcpkg/13152/2 "2025-04-03T20:54:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dave.allured](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/d/8e8cbc/32.png) [@dave.allured](https://forum.hdfgroup.org/u/dave.allured)\
**Post date:** [April 3, 2025, 9:40pm UTC](https://forum.hdfgroup.org/t/undefined-references-when-building-gdal-with-hdf5-with-vcpkg/13152/3 "2025-04-03T21:40:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hyoklee](https://forum.hdfgroup.org/user_avatar/forum.hdfgroup.org/hyoklee/32/1528_2.png) [@hyoklee](https://forum.hdfgroup.org/u/hyoklee)\
**Post date:** [April 4, 2025, 3:53am UTC](https://forum.hdfgroup.org/t/undefined-references-when-building-gdal-with-hdf5-with-vcpkg/13152/4 "2025-04-04T03:53:04Z")

</div>

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](https://github.com/hyoklee/actions/actions/runs/14257669000/job/39963151630)

Regards,
