Update hdf5 to 1.14.6; rebuild h5py#6007
Conversation
- bump 1.12.3 -> 1.14.6, update source URL template - patches/0001-fenv-fe-invalid-guard.patch: guard FE_INVALID use in H5Tinit_float.c; emscripten's <bits/fenv.h> defines only rounding modes, FE_INVALID is not declared. This patch is already upstream in hdf5 2.x and can probably be dropped once we update further https://github.com/HDFGroup/hdf5/blob/f8844a64c639f7ba33592a7948d4adacacb2d451/src/H5Tinit_float.c#L614-L617 - patches/0002-drop-soversion.patch: skip VERSION/SOVERSION properties under EMSCRIPTEN so libhdf5_hl.so records bare "libhdf5.so" as its NEEDED entry. Otherwise it records "libhdf5.so.310.5.1" while other packages link with -lhdf5 and record "libhdf5.so". The emscripten loader seems to dedupe by string identity (not realpath) and ends up loading libhdf5.so twice. One visible symptom of this was that the hdf5 metadata cache errors when calls cross between those two loaded instances, something which blocks simple file reading and also affects netcdf4 transitively. Note that this is a hot fix and a proper solution that also works for other libraries would be nicer to have. - variant.yaml: pin hdf5 to 1.14.6 - 1.14 auto-generates settings/ so the old workaround is dropped
- HDF5_VERSION 1.12.3 -> 1.14.6 - drop the ctypes.CDLL preload prepended to __init__.py; the hdf5 SOVERSION fix makes the emscripten loader dedupe libhdf5.so properly, so the manual dlopen seems no longer needed. - add version check and a dimension-scale round-trip test that guards the HL path (H5DSset_scale + attach_scale + is_scale after reopen)
@MMesch isnt that the culprint / root-problem |
|
Here is what I did from memory:
In summary, the easiest way I know how to see it is to add the print statement for this stack head address with a hot patch at build time and then run the test. Or you dump the NEEDED strings directly but I wouldn't have guessed without the other info that a difference would be a problem. Does this help? I realize it's not that easy to reproduce but I don't have a better way right now. |
What you say makes sense to me but I frankly also don't have that much expertise on it. I also don't know anyone who has, and maybe we need to research it ourselves. |
|
regarding dumping the needed strings, I still have the cache on my computer and this is the command (using nix here to pull in the wabt package): |
|
@DerThorsten , I just tried to make a local reproducer of this on small dummy files ... and I can't reproduce. In other words, emscripten does not dedup simply by string but in a more elaborate way locally. I didn't understand yet why and what the difference to this PR is. Will look deeper into it tomorrow. |
|
https://github.com/MMesch/wasm-soname-dedup-test minimal reproducer above. Roughly the story likely goes like this:
|
|
I did a simple scan of all latest .so on emscripten-forge-4x for NEEDED divergence (not only hdf but general) @DerThorsten . This is what came back: libhdf5 has two NEEDED variants in the wild:
It seems that maybe matio is affected but nothing else. |
Template B: Checklist for updating a package
[ ]⚠️ Bump build number if the version remains unchanged.Version changed.PR Formatting
Add [package-name]orUpdate [package-name] to [version]Package Details
Build Notes
There are two patches here, both quite simple but the second difficult to find even with Opus 4.7 assistance:
https://github.com/HDFGroup/hdf5/blob/f8844a64c639f7ba33592a7948d4adacacb2d451/src/H5Tinit_float.c#L614-L617