SkiaSharp: [BUG] DllNotFoundException: Unable to load shared library 'libSkiaSharp' or one of its dependencies.
Description
SkiaSharp does not work under MacOS and Ubuntu 18.04. I have a .net core 1.1 web application (vanilla stuff). It builds and runs fine, but when I access skia it results in the following error:
`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_memorystream_new()
SkiaSharp.SKMemoryStream..ctor()
SkiaSharp.SKMemoryStream..ctor(byte[] data)
SkiaSharp.SKBitmap.Decode(byte[] buffer)
ImageProcessor.ResizePng(byte[] data, int size) in ImageProcessor.cs
Code
internal static class ImageProcessor
{
public static byte[] ResizePng(byte[] data, int size)
{
using (var bitmap = SKBitmap.Decode(data))
{
var widthHeight = Math.Min(bitmap.Width, bitmap.Height);
var scale = (float)size / widthHeight;
var newInfo = new SKImageInfo((int)(bitmap.Width * scale), (int)(bitmap.Height * scale));
using (var scaled = bitmap.Resize(newInfo, SKFilterQuality.High))
return ToPngData(scaled);
}
}
Expected Behavior
It works fine under windows and should also under MacOS and Linux
Actual Behavior
see above.
Basic Information
- Version with issue: 1.68.0
- IDE: Visual Studio / Visual Studio Code
- Platform Target Frameworks: netstandard2.0/netcoreapp2.2
- Linux: Ubuntu 18.04
- macOS: current
- Windows Classic: (it works under windows 10 1809)
Screenshots
Reproduction Link
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 15 (4 by maintainers)
Run into the same issue on Ubuntu 18.04 Adding SkiaSharp.NativeAssets.Linux didn’t help, but adding SkiaSharp.NativeAssets.Linux.NoDependencies resolved the issue.
@mattleibow thanks for the info! I think we can move to the newer versions (2.x) soon.
@philipogorman there is the
SkiaSharp.NativeAssets.Linux
package as well. Both theSkiaSharp.NativeAssets.Linux.*
packages should also have the ARM and ARM64 if you are using the new v2 version of SkiaSharp. It also has support for Alpine.I have this info in the release notes, but I should probably move it to the main readme. https://github.com/mono/SkiaSharp/releases/tag/v2.80.0#additional