pact-net: Unable to load shared library 'pact_ffi' or one of its dependencies
Hello. I have an issue with the current PactNet Beta version (4.0.0-beta.3) in the CI pipeline.
Error Message:
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
Next, I tried to run the tests in docker with the mcr.microsoft.com/dotnet/sdk:6.0 image and the tests runed successful.
After that, I changed the image to mcr.microsoft.com/dotnet/sdk:6.0-alpine and got the following error:
Error Message:
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
Stack Trace:
at PactNet.Interop.NativeInterop.LogToBuffer(LevelFilter levelFilter)
at PactNet.Verifier.InteropVerifierProvider.Initialise()
at PactNet.Verifier.PactVerifier.InitialiseProvider(String providerName, Uri pactUri)
at PactNet.Verifier.PactVerifier.ServiceProvider(String providerName, Uri pactUri)
What additional information to provide to correct the issue?
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (13 by maintainers)
While it is technically possible to create a dynamically linked library for Alpine, it is not advisable to do so. In essence, what you are creating is a shared library with the musl C library statically linked into it. What this means, if you then try to use this library on a different version of Alpine/musl, it can result in corruption of thread state and segmentation violations.
Dynamically linked libraries will have to be built for each specific version of Alpine and musl, and I don’t see the benefit in maintaining that. If people what this, I would recommend using Debian based docker images which support dynamically linked glibc.
Hi Reetu, glad to see you got it working. I will just add a reminder that (as per Ron’s comments above) it’s highly likely you will eventually run into issues on Alpine with that setup. We don’t officially support that setup, so please do note that if you do run into issues.
Closing as the FFI lib doesn’t support Alpine currently (and may never properly) and so PactNet can’t either. We can reopen if the FFI situation changes
ah, I don’t believe Alpine is supported - see https://github.com/pact-foundation/pact-net/issues/374.
As per the issue, we can’t test it reliably yet.
We do have some instructions for alpine on linux with the ruby core
https://docs.pact.io/docker#alpine-linux
@chertby if you sort it, we would appreciate you updating the documentation or providing steps for others.