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

Cake fails to load native libraries on Ubuntu 22.04 #3931

Closed
devlead opened this issue Aug 9, 2022 · 2 comments · Fixed by #3945
Closed

Cake fails to load native libraries on Ubuntu 22.04 #3931

devlead opened this issue Aug 9, 2022 · 2 comments · Fixed by #3945
Assignees
Labels
Milestone

Comments

@devlead
Copy link
Member

devlead commented Aug 9, 2022

As discovered in actions/runner-images#6029, Cake fails to load native libraries on Ubuntu 22.04

Verifying assembly 'Cake.Sonar, Version=1.1.29.0, Culture=neutral, PublicKeyToken=null'.
Error: System.DllNotFoundException: Unable to load shared library 'libdl' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibdl: cannot open shared object file: No such file or directory
   at Cake.Core.Polyfill.AssemblyHelper.LoadUnixLibrary(String path, Int32 flags)
   at Cake.Core.Polyfill.AssemblyHelper.LoadAssembly(ICakeEnvironment environment, IFileSystem fileSystem, FilePath path) in C:\projects\cake\src\Cake.Core\Polyfill\AssemblyHelper.cs:line 54

Will need some investigation but iIssue probably in

[DllImport("libdl", EntryPoint = "dlopen")]
private static extern IntPtr LoadUnixLibrary(string path, int flags);

Which likely should on newer distros be

[DllImport("libdl.so.2", EntryPoint = "dlopen")] 
private static extern IntPtr LoadUnixLibrary2(string path, int flags); 

we probably could have a flag for which to use, unset by default, set when successful or unset and below catch try the other and set if success, so it's a one-time runtime cost.

catch (DllNotFoundException)
@devlead devlead added this to the v2.3.0 milestone Aug 9, 2022
@devlead devlead self-assigned this Aug 12, 2022
devlead added a commit to devlead/cake that referenced this issue Aug 12, 2022
* Better RID detection on OSX
* Support libdl 2
* Better OSX dylib support
* Native library integration tests
* Assembly load diagnostic logging
* Build & test on Ubuntu 22.04
* fixes cake-build#3931
gep13 added a commit that referenced this issue Aug 22, 2022
GH3931: Improve posix native library loading
@HofmeisterAn
Copy link

Thanks 🙏

@cake-build-bot
Copy link

🎉 This issue has been resolved in version v2.3.0 🎉

The release is available on:

Your GitReleaseManager bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants