Skip to content

hdf5: static linking broken #27380

@svillemot

Description

@svillemot

Description / Steps to reproduce the issue

As of hdf5 2.0.0-2, static linking is (again) broken.

For example, using h5_write.c:

$ gcc -static h5_write.c $(pkg-config --static --libs hdf5) -o h5_write
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/15.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/15.2.0/../../../../lib\libhdf5.a(H5FDros3_s3comms.c.obj):(.text+0x2f): undefined reference to `__imp_aws_mutex_lock'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/15.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/15.2.0/../../../../lib\libhdf5.a(H5FDros3_s3comms.c.obj):(.text+0x50): undefined reference to `__imp_aws_credentials_acquire'
[…]

The pkg-config file obviously lacks the right linking flags for AWS libraries, which seem to be: -laws-c-auth -laws-c-http -laws-c-io -laws-c-s3 -laws-c-sdkutils -laws-c-compression -laws-c-cal -laws-checksums -laws-c-common -lssl.

But even adding these manually to the pkg-config file is not enough. One keeps getting the same error messages. It seems as if the static HDF5 library was linked against the dynamic AWS libraries.

Expected behavior

Static linking to work.

Actual behavior

Does not work, per above description.

Verification

Windows Version

MSYS_NT-10.0-26200

MINGW environments affected

  • MINGW64
  • MINGW32
  • UCRT64
  • CLANG64
  • CLANGARM64

Are you willing to submit a PR?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions