linuxchromium-embedded.soavaloniaui

CefNet DllNotFoundException on Linux


I implemented the webview from the CefNet package on Windows and it works fine. Now that I moved to implementing it on Linux (Ubuntu), the NativeMethods.dlopen method in the initialization process always throws the DllNotFoundException error. The only mentioning of the error I found was answered that the major and minor versions of the CefNet package and the CEF build must match, which they absolutely do in my case: CefNet version 105.3.22248.142 and CEF-Linux64 version 105.3.39, and the path to the cef is evaluated correctly, so I don't really get it what else could be the problem


Solution

  • I had a quick look at CefNet source code, and found the dlopen P/Invoke declaration potentially causing the problem:

    https://github.com/CefNet/CefNet/blob/85bfe1c0b81e3f5a060d456bbff66e47fda0d493/CefNet/Unsafe/NativeMethods.cs#L34

        [DllImport("libdl", CallingConvention = CallingConvention.Cdecl, SetLastError = false)]
        public static extern IntPtr dlopen(string path, int mode);
    

    As I can understand, the libdl.so may appear to be missing in your Linux environment. We have recently resolved the similar problem when implementing Linux support in DotNetBrowser (this is a commercial competitor to the solutions like CefNet). You can either replace the library name to libdl.so.2 in the CefNet source code and rebuild it locally, or try making a symlink in the operating system that redirects from libdl.so to libdl.so.2. After that, the DllNotFoundException should be gone.