Unable to load shared library 'libSkiaSharp' or one of its dependencies - azure app service on Linux

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:45 (16 by maintainers)

github_iconTop GitHub Comments

5reactions
swhardencommented, Oct 17, 2021

This also solved my issue, allowing Maui.Graphics tests to run on Linux in GitHub Actions 👍 🚀

<PackageReference Include="Microsoft.Maui.Graphics" Version="6.0.101-preview.9.512" />
<PackageReference Include="Microsoft.Maui.Graphics.Skia" Version="6.0.101-preview.9.512" />
<PackageReference Include="SkiaSharp" Version="2.88.0-preview.145" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.88.0-preview.145" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.88.0-preview.145" />

Previously my error was:


System.TypeInitializationException : The type initializer for 'SkiaSharp.SKFontManager' threw an exception.
----> 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
Stack Trace:
 at Microsoft.Maui.Graphics.Skia.SkiaFontService.InitializeFontFamilies()
     ...
--DllNotFoundException
   at SkiaSharp.SkiaApi.sk_fontmgr_ref_default()
   at SkiaSharp.SKFontManager..cctor()
3reactions
DavidErbencommented, Jul 19, 2022

I managed to get the dll using this package “HarfBuzzSharp.NativeAssets.Linux” Version=“2.8.2.1-preview.79”

Thanks for the hint @marciosarabando, installing the package “HarfBuzzSharp.NativeAssets.Linux” solved it for me as well (.NET 6 running on Raspberry Pi Linux).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to load shared library 'libSkiaSharp' or one of its ...
I had a pretty similar issue. In my case the issue was the same message: dotnet can not find the libraries. The nuget...
Read more >
Unable to load shared library 'libSkiaSharp' or one of its ...
I try run app on dotnet 2.1 (ubuntu), but its show errors. How solve it? 21.3.0.
Read more >
Unable to load shared library 'libSkiaSharp' or one of its ...
I have encountered an exception when reading to GetDocumentInfo().PageCount. Im using the GroupDocs.Parser version 21.5.0 from nuget and running on a linux ......
Read more >
Karim
Unable to load shared library 'libSkiaSharp' or one of its dependencies - azure app service on... Description Just like the bug that was ......
Read more >
System.DllNotFoundException - Microsoft Q&A
The type initializer for 'SkiaSharp.SKImageInfo' threw an exception. Unable to load shared library 'libSkiaSharp' or one of its dependencies ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found