cake
cake copied to clipboard
Cake fails to load native libraries on Ubuntu 22.04
trafficstars
As discovered in https://github.com/actions/runner-images/issues/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
https://github.com/cake-build/cake/blob/c3f74155e88388b2354a5359a0fdde5fa5362ceb/src/Cake.Core/Polyfill/AssemblyHelper.cs#L74-L75
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)
Thanks 🙏