SkiaSharp: Unable to load shared library 'libSkiaSharp' or one of its dependencies - azure app service on Linux
Description
Just like the bug that was closed #1312 . Except this one is not using any other external libs, it’s just the Skia code.
A page that accesses Skia on Azure Linux fails. The same page on Windows desktop or Azure runs fine.
Exception
DllNotFoundException: Unable to load shared library 'libSkiaSharp' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibSkiaSharp: cannot open shared object file: No such file or directory
SkiaSharp.SkiaApi.sk_managedstream_set_procs(SKManagedStreamDelegates procs)
TypeInitializationException: The type initializer for 'SkiaSharp.SKAbstractManagedStream' threw an exception.
SkiaSharp.SKAbstractManagedStream..ctor(bool owns)
Raw
System.DllNotFoundException: Unable to load shared library 'libSkiaSharp' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibSkiaSharp: cannot open shared object file: No such file or directory
at SkiaSharp.SkiaApi.sk_managedstream_set_procs(SKManagedStreamDelegates procs)
at SkiaSharp.SKAbstractManagedStream..cctor()
<PackageReference Include="Azure.Cosmos" Version="4.0.0-preview3" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.5" />
<PackageReference Include="Microsoft.Azure.Cosmos.Table" Version="2.0.0-preview" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.3" />
<PackageReference Include="Azure.ImageOptimizer" Version="1.1.0.39" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.5.0-preview.1" />
<PackageReference Include="SkiaSharp" Version="2.80.0-preview.14" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.80.0-preview.14" />
- Version with issue: Both 1.6 and 2.8 preview (NUGET)
- IDE: VS2019
- Core 3.1, Azure Linux App Service
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 45 (16 by maintainers)
Commits related to this issue
- Fix the checks for dependencies #1341 — committed to mono/SkiaSharp by mattleibow 4 years ago
- Alpine appears to not be ignoring the request to build without fontconfig (#1416) * Fix the checks for dependencies #1341 * lines * gnArgs wasn't being added to the build * echo * asdfdf * asdf... — committed to mono/SkiaSharp by mattleibow 4 years ago
- CI: add SkiaSharp native assets for Linux https://github.com/mono/SkiaSharp/issues/1341 — committed to swharden/NDepend-Badges by swharden 3 years ago
- CI: SkiaSharp.NativeAssets.Linux match version https://github.com/mono/SkiaSharp/issues/1341 — committed to swharden/NDepend-Badges by swharden 3 years ago
This also solved my issue, allowing Maui.Graphics tests to run on Linux in GitHub Actions 👍 🚀
Previously my error was:
Thanks for the hint @marciosarabando, installing the package “HarfBuzzSharp.NativeAssets.Linux” solved it for me as well (.NET 6 running on Raspberry Pi Linux).
This solved my issue (2.80.3) on openSUSE
I tested both modes. Single single and both.
After spending hours, issue turned out to be this:
The artifact folder looks like this.
It has different libSkiaSharp.so inside each linux-* folder. But for some reason, those aren’t getting picked up.
Then I did this, basically copied libSkiaSharp.so to the root {artifact} folder. (linux-x64 in my case).
And everything seems to be working just fine.
P.S:
If getting the artifact from Build (rather than Publish),
I think I need to find a way to detect this missing library on linux and give a slightly better exception to ask you to install the package.
Thanks a lot! This is work for me.
Since this is Azure Linux App Service users cannot install anything.
I’ll try the NoDependencies since this purely image based, no fonts, which I’m assuming is text functions. I’ll report back.
Hi all,
Thanks, this forum helps to solve my problem.
I was having trouble using the lib QuestPDF running in a web api .net hosted in linux with the exception below:
“System.DllNotFoundException: Unable to load shared library ‘libHarfBuzzSharp’ or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibHarfBuzzSharp: cannot open shared object file: No such file or directory”
In windows environments it’s Ok, but to run on Linux I need to reference this package e insert the library libSkiaSharp.so manually in the project.
I managed to get the dll using this package “HarfBuzzSharp.NativeAssets.Linux” Version=“2.8.2.1-preview.79”
Thank you
removing SkiaSharp and adding SkiaSharp.NativeAssets.Linux.NoDependencies solved for me for .Net Core app working in debian docker container
Could you have a look at preview 36 that was just pushed out. I think we fix an issue that was coming up for web apps.