[QUESTION] Unable to load shared library 'libSkiaSharp' or one of its dependencies.

See original GitHub issue

Deploying my dot.net 5 app with skiasharp with docker on linux, with this in my docker file:

FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine AS final

...

RUN apk add --no-cache icu-libs fontconfig curl

Build on thuesday (April 12, 2022) works fine. Build next day causes container to build and run but with runtime error:

The type initializer for 'SkiaSharp.SKData' threw an exception. 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: Error loading shared library liblibSkiaSharp: No such file or directory 

I can only assume that my apk add is now installing new versions.

  • Anyone else having this issue?
  • Anyone already found the cause?
  • What bould be a future proof way of installing the correct libraries?

Thanks!

Before arriving at above conclusion I used these references settings, none of them worked:

    <PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.80.1" />
    <PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.80.1" />
    <PackageReference Include="SkiaSharp" Version="2.80.2" />
    <PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.80.2" />
    <PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.80.2" />
    <PackageReference Include="SkiaSharp" Version="2.80.3" />
    <PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.80.3" />
    <PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.80.3" />

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
zxh126commented, Aug 8, 2022

Add Package SkiaSharp.NativeAssets.Linux or SkiaSharp.NativeAssets.Linux.NoDependencies.

0reactions
mattleibowcommented, Aug 12, 2022

I think the key here is the “or” because installing both packages results in 2 native binaries - and the build selects a random one and you get lucky.

Otherwise, for most general distros/flavors of linux, the packages should be working fine. Usually the OS installs the fontconfig files, but you can confirm by running:

readelf -d libSkiaSharp.so

If you have fontconfig or don’t mind installing/depending on it, you can use the SkiaSharp.NativeAssets.Linux package.

If you don’t have/want to install fontconfig, you need to use the SkiaSharp.NativeAssets.Linux.NoDependencies package instead.

I am closing this issue as I believe the issue is resolved. However, if this is still happening on linux, please open a new issue with specific details of the version of SkiaSharp, the version and distro of the linux used and any other dotnet and sdk versions related.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to load shared library 'libSkiaSharp' or one of its ...
A page that accesses Skia on Azure Linux fails. The same page on Windows desktop or Azure runs fine. Exception. DllNotFoundException: Unable to ......
Read more >
Unable to load shared library 'libSkiaSharp' or one of its ...
I've run the ldd command and it appears to have all of the necessary dependencies for libSkiaSharp.so. enter image description here. I've also ......
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. ... Unable to load shared library 'libSkiaSharp' or one of its...
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 >
Unable to load shared library 'libSkiaSharp' or one of its ...
Unable to load shared library 'libSkiaSharp' or one of its dependencies exception. Hey, I have encountered an exception when reading to GetDocumentInfo().
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