mono / SkiaSharp

SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library. It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
MIT License
4.37k stars 533 forks source link

[QUESTION] Why is SkiaSharp trying to load `liblibSkiaSharp` library? #2385

Open WhiteBlackGoose opened 1 year ago

WhiteBlackGoose commented 1 year ago

Hello. Thanks for your effort.

My question is, why is SkiaSharp trying to load liblibSkiaSharp and is not satisfied with just libSkiaSharp.so?

I'm trying to run an Avalonia app on NixOS via

LD_DEBUG=libs dotnet run

And from the report I see:

    298115: find library=libSkiaSharp.so [0]; searching
    298115:  search path=a lot of paths     (LD_LIBRARY_PATH)
    298115:   trying file=/nix/store/wkmc51s1nyyic7ym9c44k57wk8aqlpp9-icu4c-72.1/lib/libSkiaSharp.so
    298115:   trying file=/nix/store/ljd6gmclp24spkhcmw7lqwch4bpbq9zp-skia-sharp/bin/libSkiaSharp.so
    298115: 

Looks like it found libSkiaSharp.so file (which I put there "manually")

But then I see

    298115: find library=liblibSkiaSharp.so [0]; searching
    298115:  search path=lots of paths here     (LD_LIBRARY_PATH)
    298115:   trying file=/nix/store/wkmc51s1nyyic7ym9c44k57wk8aqlpp9-icu4c-72.1/lib/liblibSkiaSharp.so
    298115:   trying file=/nix/store/ljd6gmclp24spkhcmw7lqwch4bpbq9zp-skia-sharp/bin/liblibSkiaSharp.so
    298115:   trying file=/nix/store/3zk3527zglm18ykrvgjdhgz3a4zrfapr-libX11-1.8.1/lib/liblibSkiaSharp.so
    298115:   trying file=/nix/store/h99mc81gcsc6dsa4mfxgwjj812mljnkb-libICE-1.0.10/lib/liblibSkiaSharp.so
    298115:   trying file=/nix/store/dqsgifv5pjfja5qzh9rjih1vqmfj86n9-libSM-1.2.3/lib/liblibSkiaSharp.so
    298115:   trying file=/nix/store/sgw0sxwx46hqwlcm3d834f10p1qx7c5y-libX11-1.8.1-dev/lib/liblibSkiaSharp.so

and it tries a lot of other paths, naturally, without success. What is liblibSkiaSharp.so, and what's the difference between libSkiaSharp.so and liblibSkiaSharp.so?

kyurkchyan commented 1 year ago

I am having the same issue but when trying to run Uno app on WSL.

DllNotFoundException: Unable to load shared library 'libSkiaSharp' or one of its dependencies. In order to help diagnose 
........
/mnt/c/Projects/Samples/Uno.Playground/Uno.Playground.Skia.Gtk/bin/Debug/net7.0/liblibSkiaSharp: cannot open shared object file: No such file or directory
avojacek commented 1 year ago

Same problem here. Looking for /app/runtimes/linux-x64/native/liblibSkiaSharp.so but there is /app/runtimes/linux-x64/native/libSkiaSharp.so Exception : ..... 2023-04-20T11:48:31.397985690Z ---> System.DllNotFoundException: Unable to load shared library 'libSkiaSharp' 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: 2023-04-20T11:48:31.397997990Z libfontconfig.so.1: cannot open shared object file: No such file or directory 2023-04-20T11:48:31.398006990Z /usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.5/libSkiaSharp.so: cannot open shared object file: No such file or directory 2023-04-20T11:48:31.398016090Z /app/libSkiaSharp.so: cannot open shared object file: No such file or directory 2023-04-20T11:48:31.398024790Z /app/runtimes/linux-x64/native/liblibSkiaSharp.so: cannot open shared object file: No such file or directory 2023-04-20T11:48:31.398033391Z /usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.5/liblibSkiaSharp.so: cannot open shared object file: No such file or directory 2023-04-20T11:48:31.398042391Z /app/liblibSkiaSharp.so: cannot open shared object file: No such file or directory 2023-04-20T11:48:31.398051691Z /app/runtimes/linux-x64/native/libSkiaSharp: cannot open shared object file: No such file or directory 2023-04-20T11:48:31.398060891Z /usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.5/libSkiaSharp: cannot open shared object file: No such file or directory 2023-04-20T11:48:31.398071891Z /app/libSkiaSharp: cannot open shared object file: No such file or directory 2023-04-20T11:48:31.398081191Z /app/runtimes/linux-x64/native/liblibSkiaSharp: cannot open shared object file: No such file or directory 2023-04-20T11:48:31.398090091Z /usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.5/liblibSkiaSharp: cannot open shared object file: No such file or directory 2023-04-20T11:48:31.398099791Z /app/liblibSkiaSharp: cannot open shared object file: No such file or directory 2023-04-20T11:48:31.398108691Z ....

mattleibow commented 1 year ago

It is just the lookup paths that the runtime tries. I think the first failure is the main issue:

libfontconfig.so.1: cannot open shared object file: No such file or directory

You may need to install fontconfig on the machine/container or use the NoDependencies version of the Linux binaries.

I think the lookup versions are based on the fact that unit uses a lib prefix and windows does not. So when a library would load a MyLibrary dependency, windows had basically 1 version: MyLibrary.dll so it can try that. But to support a no-change-required run on Unix, the runtime checks with libMyLibrary and some other variants with .so or .so.1 extensions.

avojacek commented 1 year ago

Hi, I kind of figured it out, but NoDependencies did not helped, I have to include another package (HarfBuzzSharp.NativeAssets.Linux) In order to make QuestSharp working :-) and also fonts. So for skiasharp may be NoDependencies could work, for QuestPDF it wos not enough. Anyway thank you a lot for trying to help. A.

MarkWilds commented 6 months ago

I also keep getting this. nothing works

darestov commented 2 weeks ago

Upvote. Hey developers, its just does not work at all and it's been 1.5 years! Please fix this stupid bug.