Skip to content

Ignore a stale ZSTD_FOUND when building zstd externally - #287

Open
brtnfld wants to merge 1 commit into
masterfrom
fix-stale-found-external
Open

brtnfld wants to merge 1 commit into
masterfrom
fix-stale-found-external

Conversation

@brtnfld

@brtnfld brtnfld commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Problem

With H5PL_ALLOW_EXTERNAL_SUPPORT=GIT or TGZ, the ZSTD plugin wrapper skips find_package() but still checks ZSTD_FOUND to decide whether to build zstd. If another subproject has already left ZSTD_FOUND in the cache, the wrapper skips the build and links whatever ZSTD_LIBRARIES holds. pkg_search_module() caches its results, so this can happen.

This is what breaks the macOS jobs in #286: SZ3's CMake runs pkg_search_module(ZSTD libzstd), which finds Homebrew's zstd, and the ZSTD plugin then fails:

Linking C shared module ../../bin/libh5zstd.so
ld: library 'zstd' not found

Fix

Clear ZSTD_FOUND in the external-build branch of ZSTD/CMakeLists.txt. Nothing changes when H5PL_ALLOW_EXTERNAL_SUPPORT=NO or ZSTD_USE_EXTERNAL is off.

This is a backstop. The leak itself is being fixed upstream in SZ3, which should not run pkg_search_module when it uses its bundled zstd. The other plugin wrappers use the same pattern, but nothing currently collides with them, so they are left unchanged.

Testing

macOS arm64, an installed HDF5 2.x, TGZ, with the cache seeded as pkg-config leaves it (-DZSTD_FOUND=1 -DZSTD_LIBRARIES=zstd):

  • master: h5zstd fails to build (zstd.h not found), because zstd was never built
  • this branch: zstd builds and all 5 ZSTD tests pass

When H5PL_ALLOW_EXTERNAL_SUPPORT is GIT or TGZ, the ZSTD plugin
wrapper skips find_package() but still tests ZSTD_FOUND to decide
whether to build zstd. A ZSTD_FOUND left in the cache by another
subproject (pkg_search_module caches its results) made it skip the
build and link a bare "zstd". Adding SZ3, whose CMake runs
pkg_search_module(ZSTD libzstd), broke the ZSTD plugin on macOS with
"ld: library 'zstd' not found".

Clear ZSTD_FOUND in the external-build branch.
@brtnfld
brtnfld force-pushed the fix-stale-found-external branch from a49fed6 to ce06d1f Compare October 6, 2026 22:46
@brtnfld brtnfld changed the title Ignore stale <LIB>_FOUND when building filter libraries externally Ignore a stale ZSTD_FOUND when building zstd externally Oct 6, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant