I got myself a PinePhone recently and decided to play around with .NET Core 5. I chose to use Avalonia due to its advertised cross-platform nature. I deployed the app to my phone and got faced with that error:
Unhandled exception. System.TypeInitializationException: The type initializer for 'SkiaSharp.SKImageInfo' 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: Error loading shared library liblibSkiaSharp: No such file or directory
at SkiaSharp.SkiaApi.sk_colortype_get_default_8888()
at SkiaSharp.SKImageInfo..cctor()
--- End of inner exception stack trace ---
at Avalonia.Skia.PlatformRenderInterface..ctor(ISkiaGpu skiaGpu, Nullable`1 maxResourceBytes)
at Avalonia.Skia.SkiaPlatform.Initialize(SkiaOptions options)
at Avalonia.SkiaApplicationExtensions.<>c__0`1.<UseSkia>b__0_0()
at Avalonia.Controls.AppBuilderBase`1.Setup()
at Avalonia.Controls.AppBuilderBase`1.SetupWithLifetime(IApplicationLifetime lifetime)
at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode)
at DummyCounter.Program.Main(String[] args)
Aborted
Weirdly enough, the libSkiaSharp.so
library file is present in the same folder as the executable. The folder was created through the dotnet publish
command below:
dotnet publish -r alpine-arm64 DummyCounter -o ./publish
I've tried a few different things, changing the architecture to linux-musl-arm64, deploying the app as self-contained and/or single-file but I still get the same exact result. Has anyone seen anything like this before?