Skip to content

Installation issue: hdf5 static build with tests fails (undefined references) #2714

@sibcse

Description

@sibcse

Steps to reproduce the issue

Installing hdf5 with the ~shared spec and enabled tests (spack install --test=root) results in a build error in the 'check_install' phase.

$ spack spec -I [email protected]
 -   [email protected]~cxx~fortran~hl~ipo~java~map~mpi~shared~szip~threadsafe+tools api=default build_system=cmake build_type=Release generator=make platform=linux os=ubuntu24.04 target=skylake %[email protected]
[e]      ^[email protected]~doc+ncurses+ownlibs~qtgui build_system=generic build_type=Release platform=linux os=ubuntu24.04 target=x86_64 
[+]      ^[email protected] build_system=generic platform=linux os=ubuntu24.04 target=skylake 
[e]      ^[email protected]~binutils+bootstrap~graphite~mold~nvptx~piclibs~profiled~strip build_system=autotools build_type=RelWithDebInfo languages:='c,c++,fortran' platform=linux os=ubuntu24.04 target=x86_64 
[+]      ^[email protected] build_system=generic platform=linux os=ubuntu24.04 target=skylake 
[e]      ^[email protected] build_system=autotools platform=linux os=ubuntu24.04 target=x86_64 
[e]      ^[email protected]~guile build_system=generic platform=linux os=ubuntu24.04 target=x86_64 
[e]      ^[email protected] build_system=autotools platform=linux os=ubuntu24.04 target=x86_64 
[+]      ^[email protected]+compat+new_strategies+opt+pic+shared build_system=autotools platform=linux os=ubuntu24.04 target=skylake %c,[email protected]

Error message

Error message

The error occurs after all the usual HDF5 tests have already passed: After installation, the test_check_prog() function in package.py is called only if run_tests==True, which compiles and runs a very small executable that prints the HDF5 version number and verifies it matches the spack specs. The compilation of this executable fails with the error message below. This only occurs in a static build. When compiled with MPI support (+mpi), additional 'undefined references' to all the MPI functions also appear.

==> Error: ProcessError: Command exited with status 1:
    '/home/my_usr/spack-1.1/opt/spack/linux-skylake/compiler-wrapper-1.0-yhvkgqt6xoi2uyegjjslmzkg3wyiefzj/libexec/spack/gcc/gcc' '-o' 'check' 'check.o' '-L/home/my_usr/spack-1.1/opt/spack/linux-skylake/hdf5-1.14.6-zy73cf2fsxxbfdflm3zhmqskrvxyl7oc/lib' '-lhdf5'

62 errors found in build log:
     8304    ==> [2025-12-10-12:29:44.118766] Find complete: ['/home/my_usr/spack-1.1/opt/spack/linux-skylake/hdf5-1.14.6-zy73
             cf2fsxxbfdflm3zhmqskrvxyl7oc/include'] ['*.h', '*.hpp', '*.hxx', '*.hh', '*.H', '*.txx', '*.tcc', '*.icc', '*.mo
             d', '*.inc']
     8305    ==> [2025-12-10-12:29:44.119088] '/home/my_usr/spack-1.1/opt/spack/linux-skylake/compiler-wrapper-1.0-yhvkgqt6xoi
             2uyegjjslmzkg3wyiefzj/libexec/spack/gcc/gcc' '-c' 'check.c' '-I/home/my_usr/spack-1.1/opt/spack/linux-skylake/hdf
             5-1.14.6-zy73cf2fsxxbfdflm3zhmqskrvxyl7oc/include'
     8306    ==> [2025-12-10-12:29:44.157508] Find (max depth = None): ['/home/my_usr/spack-1.1/opt/spack/linux-skylake/hdf5-1
             .14.6-zy73cf2fsxxbfdflm3zhmqskrvxyl7oc/lib'] ['libhdf5.a']
     8307    ==> [2025-12-10-12:29:44.157756] Find complete: ['/home/my_usr/spack-1.1/opt/spack/linux-skylake/hdf5-1.14.6-zy73
             cf2fsxxbfdflm3zhmqskrvxyl7oc/lib'] ['libhdf5.a']
     8308    ==> [2025-12-10-12:29:44.157949] '/home/my_usr/spack-1.1/opt/spack/linux-skylake/compiler-wrapper-1.0-yhvkgqt6xoi
             2uyegjjslmzkg3wyiefzj/libexec/spack/gcc/gcc' '-o' 'check' 'check.o' '-L/home/my_usr/spack-1.1/opt/spack/linux-sky
             lake/hdf5-1.14.6-zy73cf2fsxxbfdflm3zhmqskrvxyl7oc/lib' '-lhdf5'
     8309    /usr/bin/ld: /home/my_usr/spack-1.1/opt/spack/linux-skylake/hdf5-1.14.6-zy73cf2fsxxbfdflm3zhmqskrvxyl7oc/lib/libh
             df5.a(H5Fint.c.o): in function `H5F_track_metadata_read_retries':
  >> 8310    H5Fint.c:(.text+0x471d): undefined reference to `log10'
     8311    /usr/bin/ld: /home/my_usr/spack-1.1/opt/spack/linux-skylake/hdf5-1.14.6-zy73cf2fsxxbfdflm3zhmqskrvxyl7oc/lib/libh
             df5.a(H5Fint.c.o): in function `H5F_set_retries':
  >> 8312    H5Fint.c:(.text+0x483d): undefined reference to `log10'
     8313    /usr/bin/ld: /home/my_usr/spack-1.1/opt/spack/linux-skylake/hdf5-1.14.6-zy73cf2fsxxbfdflm3zhmqskrvxyl7oc/lib/libh
             df5.a(H5Tconv_integer.c.o): in function `H5T__conv_i_f':
  >> 8314    H5Tconv_integer.c:(.text+0x1391): undefined reference to `pow'
  >> 8315    /usr/bin/ld: H5Tconv_integer.c:(.text+0x175d): undefined reference to `pow'
     8316    /usr/bin/ld: /home/my_usr/spack-1.1/opt/spack/linux-skylake/hdf5-1.14.6-zy73cf2fsxxbfdflm3zhmqskrvxyl7oc/lib/libh
             df5.a(H5Tinit_float.c.o): in function `H5T__init_native_float_types':
  >> 8317    H5Tinit_float.c:(.text+0x43f): undefined reference to `feholdexcept'
  >> 8318    /usr/bin/ld: H5Tinit_float.c:(.text+0xd7e): undefined reference to `feclearexcept'
  >> 8319    /usr/bin/ld: H5Tinit_float.c:(.text+0xd8e): undefined reference to `feupdateenv'
     8320    /usr/bin/ld: /home/my_usr/spack-1.1/opt/spack/linux-skylake/hdf5-1.14.6-zy73cf2fsxxbfdflm3zhmqskrvxyl7oc/lib/libh
             df5.a(H5VLnative_token.c.o): in function `H5VL__native_token_to_str':
  >> 8321    H5VLnative_token.c:(.text+0xcc): undefined reference to `log10'
     8322    /usr/bin/ld: /home/my_usr/spack-1.1/opt/spack/linux-skylake/hdf5-1.14.6-zy73cf2fsxxbfdflm3zhmqskrvxyl7oc/lib/libh
             df5.a(H5Zdeflate.c.o): in function `H5Z__filter_deflate':
  >> 8323    H5Zdeflate.c:(.text+0xc0): undefined reference to `inflateInit_'
  >> 8324    /usr/bin/ld: H5Zdeflate.c:(.text+0x195): undefined reference to `inflate'
  >> 8325    /usr/bin/ld: H5Zdeflate.c:(.text+0x1bb): undefined reference to `inflateEnd'
  >> 8326    /usr/bin/ld: H5Zdeflate.c:(.text+0x1d4): undefined reference to `compressBound'
  >> 8327    /usr/bin/ld: H5Zdeflate.c:(.text+0x208): undefined reference to `compress2'
  >> 8328    /usr/bin/ld: H5Zdeflate.c:(.text+0x244): undefined reference to `inflateEnd'
  >> 8329    /usr/bin/ld: H5Zdeflate.c:(.text+0x388): undefined reference to `inflateEnd'
     8330    /usr/bin/ld: /home/my_usr/spack-1.1/opt/spack/linux-skylake/hdf5-1.14.6-zy73cf2fsxxbfdflm3zhmqskrvxyl7oc/lib/libh
             df5.a(H5Zscaleoffset.c.o): in function `H5Z__filter_scaleoffset':
  >> 8331    H5Zscaleoffset.c:(.text+0x6ee): undefined reference to `pow'
  >> 8332    /usr/bin/ld: H5Zscaleoffset.c:(.text+0xd5c): undefined reference to `pow'
  >> 8333    /usr/bin/ld: H5Zscaleoffset.c:(.text+0xd73): undefined reference to `pow'
  >> 8334    /usr/bin/ld: H5Zscaleoffset.c:(.text+0xd90): undefined reference to `round'
  >> 8335    /usr/bin/ld: H5Zscaleoffset.c:(.text+0xdb0): undefined reference to `pow'
  >> 8336    /usr/bin/ld: H5Zscaleoffset.c:(.text+0xdc7): undefined reference to `pow'
  >> 8337    /usr/bin/ld: H5Zscaleoffset.c:(.text+0xde4): undefined reference to `llround'
  >> 8338    /usr/bin/ld: H5Zscaleoffset.c:(.text+0xe48): undefined reference to `pow'
  >> 8339    /usr/bin/ld: H5Zscaleoffset.c:(.text+0xe5f): undefined reference to `pow'
  >> 8340    /usr/bin/ld: H5Zscaleoffset.c:(.text+0xe7c): undefined reference to `lround'
  >> 8341    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x4385): undefined reference to `powf'
  >> 8342    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x4398): undefined reference to `powf'
  >> 8343    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x43c0): undefined reference to `roundf'
  >> 8344    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x4455): undefined reference to `powf'
  >> 8345    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x4502): undefined reference to `powf'
  >> 8346    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x4b4b): undefined reference to `powf'
  >> 8347    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x4b63): undefined reference to `powf'
  >> 8348    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x4b8b): undefined reference to `llroundf'
  >> 8349    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x4c16): undefined reference to `powf'
  >> 8350    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x4c2d): undefined reference to `powf'
  >> 8351    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x4c46): undefined reference to `lroundf'
  >> 8352    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x4d10): undefined reference to `pow'
  >> 8353    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x4d83): undefined reference to `pow'
  >> 8354    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x4e0c): undefined reference to `powf'
  >> 8355    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x4e1f): undefined reference to `powf'
  >> 8356    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x4e3e): undefined reference to `roundf'
  >> 8357    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x4e5b): undefined reference to `powf'
  >> 8358    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x4e6e): undefined reference to `powf'
  >> 8359    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x4e8d): undefined reference to `llroundf'
  >> 8360    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x4f3e): undefined reference to `powf'
  >> 8361    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x5788): undefined reference to `powf'
  >> 8362    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x579f): undefined reference to `powf'
  >> 8363    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x57c5): undefined reference to `lroundf'
  >> 8364    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x5864): undefined reference to `pow'
  >> 8365    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x7e53): undefined reference to `pow'
  >> 8366    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x7ebc): undefined reference to `pow'
  >> 8367    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x7f16): undefined reference to `pow'
  >> 8368    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x7f2d): undefined reference to `pow'
  >> 8369    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x7f46): undefined reference to `round'
  >> 8370    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x7f66): undefined reference to `pow'
  >> 8371    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x7f7d): undefined reference to `pow'
  >> 8372    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x7f96): undefined reference to `llround'
  >> 8373    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x802f): undefined reference to `pow'
  >> 8374    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x81dc): undefined reference to `pow'
  >> 8375    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x81f6): undefined reference to `pow'
  >> 8376    /usr/bin/ld: H5Zscaleoffset.c:(.text+0x8215): undefined reference to `lround'
  >> 8377    collect2: error: ld returned 1 exit status

Information on your system

$ spack debug report
* **Spack:** 1.1.0 (https://github.com/spack/spack/commit/89b3f0baae13477ee5384cd30ebf512489a69890)
* **Builtin repo:** https://github.com/spack/spack-packages/commit/119680aeee8ea802c6111b7167583bddef97e82f
* **Python:** 3.12.3
* **Platform:** linux-ubuntu24.04-skylake

Additional information

spack_build_out.txt

Maintainer mentions

@brtnfld @gheber @hyoklee @lkurz @lrknox

General information

  • I have run spack debug report and reported the version of Spack/Python/Platform
  • I have run spack maintainers <name-of-the-package> and @mentioned any maintainers
  • I have uploaded the build log and environment files
  • I have searched the issues of this repo and believe this is not a duplicate

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions