HDFGroup / HDF.PInvoke

Raw HDF5 Power for .NET
http://www.hdfgroup.org/HDF5
Other
80 stars 29 forks source link

Alpine support #177

Open zingmars opened 2 years ago

zingmars commented 2 years ago

Alpine Linux is a lightweight Linux distro usually used in containers. It's fairly popular due its small size. Unfortunately it differs from other Linux distributions by using an alternative libc - musl libc, as opposed to gnu's libc used by most standard mainstrean distributions. This often causes support issues, which seems to be the case this time.

Currently the native libraries shipped with th HDF.PInvoke depend on gnu's libc, which means it will just segfault when you try to run it -

/usr/local/bin/app/runtimes/linux-x64/native # readelf -d libhdf5.so | grep 'NEEDED'
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

For reference, confluence's libkafka for C# also ships with native linux binaries, and the have binaries for both gnu's libc based distributions and alpine. Here's the readelf output for their alpine library -

/usr/local/bin/app/runtimes/linux-x64/native # readelf -d alpine-librdkafka.so | grep 'NEEDED'
 0x0000000000000001 (NEEDED)             Shared library: [libssl.so.1.1]
 0x0000000000000001 (NEEDED)             Shared library: [libcrypto.so.1.1]
 0x0000000000000001 (NEEDED)             Shared library: [libz.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.musl-x86_64.so.1]

Are there any plans to support alpine in the future and if not what are the chances that such support will ever be added?

zingmars commented 2 years ago

For what it's worth, I was able to compile HDF5 using https://github.com/HDFGroup/HDF.PInvoke.1.10/blob/native-CI/build/build.ps1 and then overwrite the versions restored by dotnet build and it seems to work fine, so there's nothing preventing HDF.PInvoke from working on this platform.