hdf5 icon indicating copy to clipboard operation
hdf5 copied to clipboard

Build error with zlib-ng on macOS arm64

Open ajelenak opened this issue 1 year ago • 1 comments

Describe the bug Building libhdf5 with zlib-ng produces this error:

Undefined symbols for architecture arm64:
  "_compress2", referenced from:
      _H5Z__filter_deflate in H5Zdeflate.c.o
  "_compressBound", referenced from:
      _H5Z__filter_deflate in H5Zdeflate.c.o
  "_inflate", referenced from:
      _H5Z__filter_deflate in H5Zdeflate.c.o
  "_inflateEnd", referenced from:
      _H5Z__filter_deflate in H5Zdeflate.c.o
  "_inflateInit_", referenced from:
      _H5Z__filter_deflate in H5Zdeflate.c.o
ld: symbol(s) not found for architecture arm64
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)

Expected behavior Successfully build libhdf5 using zlib-ng library on macOS arm64 computers.

Platform (please complete the following information)

  • HDF5 version from development branch at commit f8069fa8. After this commit, the build fails with an error about not finding zlib-ng.
  • OS and version: macOS Sonoma 14.5 arm64
  • Compiler and version: clang version 15.0.7
  • Build system: cmake version 3.30.0
  • Any configure options you specified:
    -DHDF5_USE_ZLIB_NG:BOOL=ON
    -DZLIB_LIBRARY:FILEPATH=/path/to/env/lib/libz-ng.2.dylib
    -DZLIB_INCLUDE_DIR:PATH=/path/to/env/include
    -DZLIB_USE_EXTERNAL:BOOL=OFF
    
  • MPI library and version (parallel HDF5): n/a

Additional context Installed zlib-ng version 2.2.1.

ajelenak avatar Jul 15 '24 23:07 ajelenak

I believe the problem is that the CMake FindZLIB.cmake module file doesn't provide the target and names as expected - will have a new PR that should address this.

byrnHDF avatar Jul 16 '24 15:07 byrnHDF

@byrnHDF Any update on this? An ETA for the mentioned PR?

ajelenak avatar Aug 08 '24 15:08 ajelenak

Update

Used the develop branch at commit d875f74 and built zlib-ng from source. Zlib-ng can be built in the old zlib API-compatible mode but that is not the default. The shared library I used above, libz-ng.2.dylib, is not zlib-compatible. It provides the reported missing symbols with the extra _zng prefix: _zng_inflateInit_ instead of expected _inflateInit_.

When zlib-ng is built in the zlib-compatible mode, the library builds successfully but one of its tests (dt_arith) fails.

I will close this issue as it seems zlib-ng built in zlib-compatible mode can be used to build the library. How to deal with available zlib-ng packages that are not zlib API compatible is for some future discussion.

ajelenak avatar Aug 13 '24 15:08 ajelenak