https://pact.io logo
#pact-net
Title
# pact-net
c

Cyrus Devnomad

03/01/2022, 6:18 PM
Hi I have a Pact.NET consumer unit test using .NET 6.0 which works normally on two different local Windows developer machines but it fails if the same code is built and executed in the linux docker image mcr.microsoft.com/dotnet/sdk:6.0-alpine. I get the following error: System.TypeInitializationException : The type initializer for 'PactNet.Native.Interop.NativeInterop' threw an exception. ---- System.DllNotFoundException : Unable to load shared library 'pact_ffi' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: Error loading shared library libpact_ffi: No such file or directory Any ideas?
m

Matt (pactflow.io / pact-js / pact-go)

03/01/2022, 9:22 PM
hmmm I can’t remember if we support alpine linux. Any chance you could please try a vanilla linux container first? If that works, it’s either that we need an alpine specific shared library built, or there is some OS dependency that is needed
Before you do tho can you please set
LD_DEBUG=all
into the environment, and try again?
that will help
a

Adam Rodger (pact-net)

03/02/2022, 7:30 AM
Yeah I'm pretty sure MUSL targets won't work. I think the Rust library is built for libc x64
Yes - this has the
linux-x64
runtime identifier, and there's no entry for
linux-musl-x64
The supported runtime IDs for .Net are here, so MUSL is possible, just not currently supported: https://docs.microsoft.com/en-us/dotnet/core/rid-catalog#linux-rids
And that's because the FFI library doesn't compile for MUSL https://github.com/pact-foundation/pact-reference/releases/tag/libpact_ffi-v0.2.2
m

Matt (pactflow.io / pact-js / pact-go)

03/02/2022, 8:00 AM
We should be able to add it. I recall we did have something for it a while back for JS.
Can you please check if an issue has been raised and if not, raise one @Cyrus Devnomad https://github.com/pact-foundation/pact-reference/releases
c

Cyrus Devnomad

03/02/2022, 1:51 PM
Ok, I've tested the same consumer unit test on the correspondig non-alpine image (mcr.microsoft.com/dotnet/sdk:6.0) from microsoft and that pact_ffi related error mentioned above no longer appears. So the issue is indeed related to the alpine version as you both have suggested. https://pact-foundation.slack.com/archives/C9UTHV2AD/p1646169769668719?thread_ts=1646158689.612079&cid=C9UTHV2AD
🙏 1
a

Adam Rodger (pact-net)

03/02/2022, 1:59 PM
Yeah, thanks for confirming. libpact doesn't compile MUSL targets (needed for Alpine) and therefore PactNet doesn't ship them
Created an issue here, and will link to a request in libpact: https://github.com/pact-foundation/pact-net/issues/374
m

Matt (pactflow.io / pact-js / pact-go)

03/03/2022, 11:54 AM
awesome, thanks!