Open botondbotos opened 7 months ago
Currently there is no reliable way to detect libc vs musl during a .Net restore operation and therefore no reliable way to ensure the correct libpact binary is restored. That makes this issue currently infeasible until a reliable way of doing that detection is found.
Could you please help me understand why it is preferred to restore the correct pact_ffi package over picking the correct one at runtime? I have a PoC implemented, which is addressing the issue of musl support: https://github.com/pact-foundation/pact-net/pull/497#issuecomment-2087340260 One of the drawbacks is that all native packages need to be deployed, but the runtime can pick the correct one.
That's the design of the FFI packaging, so that the correct binary is restored to the bin folder when the NuGet is installed. That means we're leaning on existing features provided in MSBuild instead of rolling our own detection code, which is bound to be worse.
I'm not sure how runtime vs restore time is a distinction here anyway? Either way there's no reliable way to detect libc vs musl, because if there was you could use it with either style. Both call in to .Net APIs to determine the OS/arch currently, but there's no API to determine libc vs musl.
I can understand why that is also - .Net itself doesn't need to worry about that because your code is all IL and it's the installed runtime that matters. Given we're doing native interop though then it does matter to us, so the missing API matters.
Previous issues Add
linux-musl-x64
Runtime SupportIs your feature request related to a problem? Please describe. According to Compatibility / Operating System page Linux (musl) is not supported, however starting with Pact FFI Library 0.4.17 the
libpact_ffi-linux-aarch64-musl.so
andlibpact_ffi-linux-x86_64-musl.so
shared libraries are part of releases.Describe the solution you'd like Update pact-net to use latest Pact FFI Library 0.4.19 which has the
libpact_ffi
shared libraries and extend the NuGet package with additional runtime targets.Breaking Changes No
Potential Downsides/Caveats n/a
Describe alternatives you've considered n/a
Additional context After replacing the
runtimes/linux-x64/native/libpact_ffi.so
file added by PactNet 5.0.0-beta.2 package with libpact_ffi-linux-x86_64-musl.so I was able to successfully run pact-net tests inside Docker usingmcr.microsoft.com/dotnet/sdk:6.0.421-alpine3.19-amd64