Installing on M1 Mac


in the end, I just want to write a small tool to convert some binary blob to hdf5. I thought, I would use Python to do the job. When installing the prebuild binaries for OS/X, it seems, that the installed libhdf5.dylib library is just suitable for intel hardware:

%  pip install --no-binary=h5py h5py
Loading library to get build settings and version: libhdf5.dylib
error: Unable to load dependency HDF5, make sure HDF5 is installed properly
error: dlopen(libhdf5.dylib, 0x0006): tried: ... 
(mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e))),..

Now, I tried to simply build HDF5 from source, checkout the git repo, switched to the hdf5_1_10 branch and tried to build it with autoconf:

> autoreconf -i
> ./configure --prefix=/usr/local/hdf5 --enable-cxx
> make 

This results in:

Making all in src
/Applications/  all-am
  CC       H5detect.o
In file included from H5detect.c:45:
In file included from ./H5private.h:27:
./H5public.h:32:10: fatal error: 'H5version.h' file not found
#include "H5version.h"
1 error generated.

Next, I’ve tried to build the software, using CMake:

> mkdir build
> cd build
> cmake ..
> make

This leeds to undefined symbols to functions like _compress2, _inflate and _inflateEnd. Zlib is installed on the build host. H5_HAVE_ZLIB_H is defined to 1 in H5pubconf.h but -lz seems to be missing from the linker command.

When I add the missing library by hand to the linker command, I get the needed libhdf5.103.3.2.dylib.

What would be the easiest way to get this Python module (h5py) running on a M1 Mac?

Thanks in advance,