Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] The version of the native libSkiaSharp library (116.0) is incompatible with this version of SkiaSharp. #3117

Closed
1 task done
bautistavirchar opened this issue Dec 16, 2024 · 15 comments
Labels

Comments

@bautistavirchar
Copy link

Description

The version of the native libSkiaSharp library (116.0) is incompatible with this version of SkiaSharp. Supported versions of the native libSkiaSharp library are in the range [88.1, 89.0)

Code

Stream GenerateQr(string text)
{
    using var generator = new QRCodeGenerator();

    // Generate QrCode
    var qr = generator.CreateQrCode(text, ECCLevel.L);

    // Render to canvas
    var info = new SKImageInfo(512, 512);
    using var surface = SKSurface.Create(info);
    var canvas = surface.Canvas;
    canvas.Render(qr, info.Width, info.Height);

    // Output to Stream -> File
    using var image = surface.Snapshot();
    using var data = image.Encode(SKEncodedImageFormat.Png, 100);

    var img = SKImage.FromPixels(image.PeekPixels());
    // encode the image (defaults to PNG)
    var encoded = image.Encode();
    // get a stream over the encoded data
    return encoded.AsStream();

}

Expected Behavior

WORKING VERSION 2.88.9

<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.88.9" />

Actual Behavior

No response

Version of SkiaSharp

3.116.0 (Current)

Last Known Good Version of SkiaSharp

2.88.9 (Previous)

IDE / Editor

Visual Studio (Windows)

Platform / Operating System

Linux

Platform / Operating System Version

Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm

Devices

No response

Relevant Screenshots

No response

Relevant Log Output

System.TypeInitializationException: The type initializer for 'SkiaSharp.SKObject' threw an exception.
       ---> System.InvalidOperationException: The version of the native libSkiaSharp library (116.0) is incompatible with this version of SkiaSharp. Supported versions of the native libSkiaSharp library are in the range [88.1, 89.0).
         at SkiaSharp.SkiaSharpVersion.CheckNativeLibraryCompatible(Version minSupported, Version current, Boolean throwIfIncompatible)
         at SkiaSharp.SkiaSharpVersion.CheckNativeLibraryCompatible(Boolean throwIfIncompatible)
         at SkiaSharp.SKObject..cctor()
         --- End of inner exception stack trace ---
         at SkiaSharp.SKObject..ctor(IntPtr handle, Boolean owns)
         at SkiaSharp.SKSurface..ctor(IntPtr h, Boolean owns)
         at SkiaSharp.SKSurface.GetObject(IntPtr handle)
         at SkiaSharp.SKSurface.Create(SKImageInfo info, Int32 rowBytes, SKSurfaceProperties props)
         at SkiaSharp.SKSurface.Create(SKImageInfo info)

Code of Conduct

  • I agree to follow this project's Code of Conduct
@mattleibow
Copy link
Contributor

mattleibow commented Dec 16, 2024

Did you update all the SkiaSharp nugets to the same version?

The error is saying you have an old native assets in your project, but a new SkiaSharp.

@bautistavirchar
Copy link
Author

@mattleibow

only this library SkiaSharp.NativeAssets.Linux.NoDependencies which the working version is 2.88.9

@elr0berto
Copy link

Got same problem. solved by downgrading to 2.88.9

@penihel
Copy link

penihel commented Dec 16, 2024

i have the same problem

@gktval
Copy link

gktval commented Jan 7, 2025

Same issue. I have SkiaSharp and SkiaSharp.View.Blazor. The nugets in the solution were all updated to 3.116.1. The fix was to clean the solution and rebuild.

@danilobreda
Copy link

danilobreda commented Jan 15, 2025

116(3.116.1) is bugged. only 88(2.88.9) and 89(does not exist) is working.
The check occurs on SkiaSharp.SkiaSharpVersion.CheckNativeLibraryCompatible

Working:
image

@vadimart92
Copy link

vadimart92 commented Jan 20, 2025

Seems like problem is only with SkiaSharp.NativeAssets.Linux.NoDependencies:

/runtimes/linux-x64/native$ readelf -d libSkiaSharp.so

Dynamic section at offset 0x8c6a60 contains 33 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libfontconfig.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [ld-linux-x86-64.so.2]
 0x000000000000000e (SONAME)             Library soname: [libSkiaSharp.so.88.1.0] <----

SkiaSharp.NativeAssets.Linux works

/runtimes/linux-x64/native$ readelf -d libSkiaSharp.so

Dynamic section at offset 0x891a30 contains 33 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libfontconfig.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [ld-linux-x86-64.so.2]
 0x000000000000000e (SONAME)             Library soname: [libSkiaSharp.so.118.0.0] <----

@TheFerrango
Copy link

The same problem happens under a Windows OS when the application is being served via IIS

@vikher
Copy link

vikher commented Mar 19, 2025

@mattleibow I’m working on a .NET MAUI app with <MauiVersion>9.0.50</MauiVersion>. The app targets both Android and iOS. When using the following SkiaSharp packages, everything works fine on both platforms:

<PackageReference Include="SkiaSharp" Version="2.88.9" />
<PackageReference Include="SkiaSharp.Views" Version="2.88.9" />
<PackageReference Include="SkiaSharp.Views.Maui.Controls" Version="2.88.9" />

However, when I update these packages to the latest versions:

<PackageReference Include="SkiaSharp" Version="3.116.1" />
<PackageReference Include="SkiaSharp.Views" Version="3.116.1" />
<PackageReference Include="SkiaSharp.Views.Maui.Controls" Version="3.116.1" />

The app continues to work on Android but fails on iOS with the following exception:

System.TypeInitializationException: The type initializer for 'SkiaSharp.SKObject' threw an exception.
 ---> System.InvalidOperationException: The version of the native libSkiaSharp library (88.1) is incompatible with this version of SkiaSharp. Supported versions of the native libSkiaSharp library are in the range [116.0, 117.0).
   at SkiaSharp.SkiaSharpVersion.CheckNativeLibraryCompatible(Version minSupported, Version current, Boolean throwIfIncompatible)
   at SkiaSharp.SkiaSharpVersion.CheckNativeLibraryCompatible(Boolean throwIfIncompatible)
   at SkiaSharp.SKObject..cctor()
   --- End of inner exception stack trace ---
   at SkiaSharp.SKSurface..ctor(IntPtr h, Boolean owns)
   at SkiaSharp.SKSurface.GetObject(IntPtr handle)
   at SkiaSharp.SKSurface.Create(SKImageInfo info, IntPtr pixels, Int32 rowBytes, SKSurfaceReleaseDelegate releaseProc, Object context, SKSurfaceProperties props)
   at SkiaSharp.SKSurface.Create(SKImageInfo info, IntPtr pixels, Int32 rowBytes)
   at SkiaSharp.Views.iOS.SKCGSurfaceFactory.CreateSurface(CGRect contentsBounds, NFloat scale, SKImageInfo& info)
   at SkiaSharp.Views.iOS.SKCanvasView.Draw(CGRect rect)
   at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName)
   at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass)
   at Mobile.Program.Main(String[] args) in /Users/victorsanchez/Mobile-Maui/Mobile/Platforms/iOS/Program.cs:line 12

It seems the native libSkiaSharp library on iOS remains at version 88.1, which is incompatible with SkiaSharp 3.116.1 (expecting 116.0–117.0). This issue doesn’t occur on Android. Has anyone encountered this with .NET MAUI 9.0.50 on iOS, or is there a known fix to ensure the correct native library version is used?

@mattleibow
Copy link
Contributor

Could you attach a binlog?

If you clean and rebuild, does it go away? What about building on the CLI?

@ladeak
Copy link

ladeak commented Mar 20, 2025

@bautistavirchar could you confirm if this is going to be part of an upcoming release, or closed with a different reason? Did you use some sort of a workaround?

@jacobilsoe
Copy link

jacobilsoe commented Mar 21, 2025

@mattleibow I’m working on a .NET MAUI app with <MauiVersion>9.0.50</MauiVersion>. The app targets both Android and iOS. When using the following SkiaSharp packages, everything works fine on both platforms:

<PackageReference Include="SkiaSharp" Version="2.88.9" />
<PackageReference Include="SkiaSharp.Views" Version="2.88.9" />
<PackageReference Include="SkiaSharp.Views.Maui.Controls" Version="2.88.9" />

However, when I update these packages to the latest versions:

<PackageReference Include="SkiaSharp" Version="3.116.1" />
<PackageReference Include="SkiaSharp.Views" Version="3.116.1" />
<PackageReference Include="SkiaSharp.Views.Maui.Controls" Version="3.116.1" />

The app continues to work on Android but fails on iOS with the following exception:

System.TypeInitializationException: The type initializer for 'SkiaSharp.SKObject' threw an exception.
 ---> System.InvalidOperationException: The version of the native libSkiaSharp library (88.1) is incompatible with this version of SkiaSharp. Supported versions of the native libSkiaSharp library are in the range [116.0, 117.0).
   at SkiaSharp.SkiaSharpVersion.CheckNativeLibraryCompatible(Version minSupported, Version current, Boolean throwIfIncompatible)
   at SkiaSharp.SkiaSharpVersion.CheckNativeLibraryCompatible(Boolean throwIfIncompatible)
   at SkiaSharp.SKObject..cctor()
   --- End of inner exception stack trace ---
   at SkiaSharp.SKSurface..ctor(IntPtr h, Boolean owns)
   at SkiaSharp.SKSurface.GetObject(IntPtr handle)
   at SkiaSharp.SKSurface.Create(SKImageInfo info, IntPtr pixels, Int32 rowBytes, SKSurfaceReleaseDelegate releaseProc, Object context, SKSurfaceProperties props)
   at SkiaSharp.SKSurface.Create(SKImageInfo info, IntPtr pixels, Int32 rowBytes)
   at SkiaSharp.Views.iOS.SKCGSurfaceFactory.CreateSurface(CGRect contentsBounds, NFloat scale, SKImageInfo& info)
   at SkiaSharp.Views.iOS.SKCanvasView.Draw(CGRect rect)
   at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName)
   at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass)
   at Mobile.Program.Main(String[] args) in /Users/victorsanchez/Mobile-Maui/Mobile/Platforms/iOS/Program.cs:line 12

It seems the native libSkiaSharp library on iOS remains at version 88.1, which is incompatible with SkiaSharp 3.116.1 (expecting 116.0–117.0). This issue doesn’t occur on Android. Has anyone encountered this with .NET MAUI 9.0.50 on iOS, or is there a known fix to ensure the correct native library version is used?

I have exactly the same issue. Works on Android but not iOS.

Cleaning/rebuilding does not help.

@gktval
Copy link

gktval commented Mar 21, 2025

I mentioned above to clean and rebuild. But I rolled back yesterday after testing 3.118.2 to 2.88.9 and had a similar issue. It kept trying to reference 3.118. I had to delete the bin/obj folders to finally get rid of all references in iOS.

@jacobilsoe
Copy link

Deleting those folders helped. Thanks.

@lilleyd
Copy link

lilleyd commented Mar 27, 2025

I am also facing this issue on iOS, Is there a new release soon ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

No branches or pull requests