Skip to content

feat: HDF5 1.10.5+ support and rename to hdf5-rt#18

Merged
shinaoka merged 21 commits intomainfrom
feat/hdf5-1.10.5-support
Feb 5, 2026
Merged

feat: HDF5 1.10.5+ support and rename to hdf5-rt#18
shinaoka merged 21 commits intomainfrom
feat/hdf5-1.10.5-support

Conversation

@shinaoka
Copy link
Copy Markdown
Member

@shinaoka shinaoka commented Feb 5, 2026

Summary

  • Lower HDF5 minimum version from 1.12.0 to 1.10.5 for compatibility with Ubuntu packages, HDF5.jl, and h5py
  • Rename crates for general use: tensor4all-hdf5-ffihdf5-rt, tensor4all-hdf5-typeshdf5-rt-types
  • CI matrix testing for HDF5 1.10.x, 1.12.x, and 1.14.x
  • Recover tests from hdf5-metno (coverage: 70.45% → 82.27%)

Changes

HDF5 1.10.x Compatibility

  • Add pre-1.12 H5O functions (H5Oget_info1, H5Oopen_by_addr)
  • Add H5O_info1_t type for HDF5 < 1.12
  • Change LocationToken to enum supporting both pre-1.12 address and 1.12+ token
  • Runtime version detection and conditional function loading

Crate Renaming

  • tensor4all-hdf5-ffihdf5-rt
  • tensor4all-hdf5-typeshdf5-rt-types
  • Updated all imports, examples, and documentation

Recovered Tests

  • test_plist.rs (39 tests, 2 ignored)
  • test_datatypes.rs (7 tests)
  • test_object_references.rs (8 tests)
  • tests.rs (1 test with manual H5Type impl)

CI Updates

  • Test matrix: Ubuntu 22.04 (HDF5 1.10), Ubuntu 22.04 (HDF5 1.12), Ubuntu 24.04 (HDF5 1.14)
  • Feature combination testing
  • Julia and Python interop tests

Test plan

  • All 187 tests pass locally
  • cargo clippy --workspace passes
  • cargo fmt --all applied

🤖 Generated with Claude Code

shinaoka and others added 7 commits February 5, 2026 21:29
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add HDF5_RUNTIME_VERSION global static to store detected version
- Add hdf5_version() and hdf5_version_at_least() accessors
- Change minimum version from 1.12.0 to 1.10.5

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- H5Oget_info1 and H5Oget_info_by_name1 loaded conditionally
- H5Oopen_by_addr available in all versions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- LocationToken now has Address and Token variants
- H5O_get_info branches by HDF5 version
- H5O_open_by_token uses appropriate API based on token type

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add matrix for HDF5 version testing
- Ubuntu system HDF5 (1.10.x) tests compatibility
- Conda HDF5 1.12 and 1.14 test newer features

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@shinaoka shinaoka enabled auto-merge (squash) February 5, 2026 12:48
shinaoka and others added 2 commits February 6, 2026 05:25
- Add version-dependent wrappers for H5Sencode, H5Literate
- Fix H5Oget_info1/H5Oget_info_by_name1 signatures (no fields param)
- Add complete H5O_info1_t struct with hdr and meta_size fields
- Add convert_h5i_type for H5I_type_t enum differences between versions
- Skip test_references on HDF5 < 1.12 (requires H5R_ref_t)
- Update CI to explicitly test HDF5 1.10.x, 1.12.x, 1.14.x
- Add test script for local multi-version testing

Tested with HDF5 1.10.11, 1.12.3, 1.13.3, 1.14.5

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Rename for general use beyond tensor4all:
- tensor4all-hdf5-ffi → hdf5-rt
- tensor4all-hdf5-types → hdf5-rt-types

Also recover tests from hdf5-metno:
- test_plist.rs (39 tests, 2 ignored)
- test_datatypes.rs (7 tests)
- test_object_references.rs (8 tests)
- tests.rs (1 test with manual H5Type impl)

Test coverage improved from 70.45% to 82.27%

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@shinaoka shinaoka disabled auto-merge February 5, 2026 20:49
@shinaoka shinaoka enabled auto-merge (squash) February 5, 2026 20:49
@shinaoka shinaoka changed the title feat: support HDF5 1.10.5+ feat: HDF5 1.10.5+ support and rename to hdf5-rt Feb 5, 2026
shinaoka and others added 3 commits February 6, 2026 05:50
Homebrew on macOS now provides HDF5 2.x.
Update test to accept both HDF5 1.x and 2.x major versions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add H5T_COMPLEX type class (new in HDF5 2.0)
- Update H5T_NCLASSES to 12 for HDF5 2.0
- Update version test to accept both HDF5 1.x and 2.x

Note: Our runtime-loading approach requires handling both versions
in the same binary, unlike upstream compile-time feature flags.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Root cause: When the OnceLock<Library> was dropped at process exit,
dlclose() was called on the HDF5 library. This triggered HDF5's
internal cleanup routines which caused 'infinite loop closing library'
and SIGSEGV on Linux, especially during parallel test execution.

Solution: Use Box::leak() to intentionally leak the library handle.
This prevents dlclose() from being called, keeping the HDF5 library
loaded until process termination. This is safe because:
1. We only load the library once per process
2. The OS will reclaim all memory on process exit
3. This is a common pattern for libraries with problematic cleanup

Also reverts the CI workaround (--test-threads=1) since the root
cause is now fixed.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@shinaoka shinaoka force-pushed the feat/hdf5-1.10.5-support branch from 9151dda to 057fb0f Compare February 5, 2026 21:01
shinaoka and others added 5 commits February 6, 2026 06:05
Parallel test execution on Linux causes SIGSEGV in test_plist tests.
The root cause is still under investigation, but this workaround
allows CI to pass while we debug the issue.

macOS parallel tests work fine, so only Linux CI uses --test-threads=1.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove test-features job, use --all-features in main test job
- Temporarily disable test_plist.rs (SIGSEGV on Linux with conda HDF5)
- Add *.disabled to .gitignore

The test_plist tests work on macOS but crash on Linux.
Root cause investigation needed.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Julia 1.10 + curl 8.10+ triggers a crash in Downloads.jl during
Pkg.instantiate() due to a NULL handle dereference in curl_multi_assign.
Julia 1.11 includes a fixed Downloads.jl that avoids this issue.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- PropertyList::copy() now returns Result<Self> instead of silently
  returning an invalid handle on failure
- get_shared_mesg_indexes() uses h5get! instead of h5get_d! to
  propagate errors instead of silently defaulting to 0
- Re-enable test_plist.rs (41 tests) - SIGSEGV was caused by the
  library cleanup issue fixed in 057fb0f, not by plist operations
- Replace conda with JLL/system HDF5 in Julia interop CI to avoid
  curl_multi_assign crash in Pkg.instantiate()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use --test-threads=1 on Linux to avoid test_plist SIGSEGV in parallel
- Set LD_LIBRARY_PATH in test_interop.jl so Rust binary can dlopen
  JLL libhdf5.so and its dependencies
- Add pkg-config fallback path for Ubuntu systems

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@shinaoka shinaoka disabled auto-merge February 5, 2026 21:48
shinaoka and others added 4 commits February 6, 2026 07:07
Add gdb step to capture exact backtrace of SIGSEGV in test_fapl_common
on x86_64 Linux. This will reveal the exact crash location.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
HDF5's hbool_t is typedef'd as bool (_Bool), which is 1 byte on all
modern systems with <stdbool.h>. Our definition was c_uint (4 bytes),
causing struct layout mismatches in H5AC_cache_config_t and other
structs containing hbool_t fields.

This was the root cause of the SIGSEGV in test_plist on x86_64 Linux:
H5Pget_mdc_config wrote into H5AC_cache_config_t using 1-byte bool
offsets, but Rust read fields at 4-byte uint offsets, causing
decr_mode to contain an invalid enum discriminant.

Also removes the temporary GDB debugging CI step and continue-on-error.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add get_jll_lib_paths() to collect all JLL dependency library paths
  (Zlib_jll, libaec_jll, etc.) for LD_LIBRARY_PATH when running Rust binary
- Pin Julia interop job to ubuntu-22.04 to avoid libssl.so loading issues
  on ubuntu-24.04 where system OpenSSL 3.x conflicts with JLL OpenSSL 1.1

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove system HDF5 variant from Julia interop CI (JLL is the standard path)
- Add get_jll_lib_paths() to include all JLL dependency dirs in LD_LIBRARY_PATH
- Fix read(attrs(file), key) -> read_attribute(file, key) for newer HDF5.jl

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@shinaoka shinaoka enabled auto-merge (squash) February 5, 2026 22:40
@shinaoka shinaoka merged commit 715489e into main Feb 5, 2026
7 checks passed
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