Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DevContainer: Unable to load shared library 'pact_ffi' or one of its dependencies wit PactNet.5.0.0-beta.2 #501

Closed
franvivas opened this issue May 27, 2024 · 3 comments
Labels
bug Indicates an unexpected problem or unintended behavior triage This issue is yet to be triaged by a maintainer

Comments

@franvivas
Copy link

Previous issues
I use last version of PactNet as you recommended

Version information:

  • OS: (e.g. MacOS ARM, M2)
  • PactNet Version: PactNet.5.0.0-beta.2
  • .Net Version: 8.0

Describe the bug
I launch my piece of test on DevContainer, but I get this error "Unable to load shared library 'pact_ffi' or one of its dependencies "

Steps To Reproduce
Repo:
link to a repository which reproduces the issue.

Steps: video with demo

Expected behavior
Pass the test

Log Output

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:00.30]     pact_test.xunit.tests.UnitTest1.Test [FAIL]
  Failed pact_test.xunit.tests.UnitTest1.Test [1 ms]
  Error Message:
   System.DllNotFoundException : Unable to load shared library 'pact_ffi' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable: 
/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.5/pact_ffi.so: cannot open shared object file: No such file or directory
/workspaces/pact_ffi/pact-test.xunit.tests/bin/Debug/net8.0/pact_ffi.so: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.5/libpact_ffi.so: cannot open shared object file: No such file or directory
/workspaces/pact_ffi/pact-test.xunit.tests/bin/Debug/net8.0/libpact_ffi.so: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.5/pact_ffi: cannot open shared object file: No such file or directory
/workspaces/pact_ffi/pact-test.xunit.tests/bin/Debug/net8.0/pact_ffi: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.5/libpact_ffi: cannot open shared object file: No such file or directory
/workspaces/pact_ffi/pact-test.xunit.tests/bin/Debug/net8.0/libpact_ffi: cannot open shared object file: No such file or directory

  Stack Trace:
     at PactNet.Interop.NativeInterop.LogToBuffer(LevelFilter levelFilter)
   at PactNet.PactExtensions.InitialiseLogging(PactLogLevel level)
   at PactNet.PactExtensions.WithHttpInteractions(IPactV4 pact, Nullable`1 port, IPAddress host)
   at pact_test.xunit.tests.UnitTest1..ctor() in /workspaces/pact_ffi/pact-test.xunit.tests/UnitTest1.cs:line 13
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)

Failed!  - Failed:     1, Passed:     0, Skipped:     0, Total:     1, Duration: < 1 ms - pact-test.xunit.tests.dll (net8.0)
@franvivas franvivas added bug Indicates an unexpected problem or unintended behavior triage This issue is yet to be triaged by a maintainer labels May 27, 2024
@adamrodger
Copy link
Contributor

First thing to try is making sure that solution works outside of a dev container. If it does then the problem must be something within the dev container itself. If it doesn't then you can fix that and retry, then perhaps it works in the dev container also.

If it works locally but not inside the dev container then the next thing to try is shelling into the dev container itself and trying to run things manually. That will include exploring the bin directory to work out where the DLL is and why it's not where the search paths listed in the log output expect it to be.

@YOU54F
Copy link
Member

YOU54F commented May 29, 2024

nice repros!

What machine are you running on? I assume macos apple silicon (uname -sm) in your terminal

If macos, .NET containers with pact net, on apple silicon won't work due to 2 reasons

  1. RFC: Add Linux (libc)-ARM Runtime Support #498 - no builds are currently provided for pact-net that target linux-aarch64
  2. qemu is not supported with .NET containers, and thus a workaround of running amd64 containers on apple silicon, won't work for pact-net

I believe I have a workable solution, which also provides musl support, using the existing packaging mechanisms, with full preference to glibc hosts, to preserve existing client behaviour and should result in a nice OOB experience for pact-net.

We can provide aarch64 binaries, but due to limitations with qemu + .NET we can't test them in CI, without relying on another CI provider (CirrusCI / CircleCI), so we would probably want a lower tier of support.

@adamrodger
Copy link
Contributor

Closed due to inactivity

@adamrodger adamrodger closed this as not planned Won't fix, can't repro, duplicate, stale Sep 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior triage This issue is yet to be triaged by a maintainer
Projects
None yet
Development

No branches or pull requests

3 participants