AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
25.28k stars 2.19k forks source link

Application has problems in linux #4994

Closed PieroCastillo closed 3 years ago

PieroCastillo commented 3 years ago

hi, I've this project, Aura.UI Sample App, in Windows 10 there aren't any problem, but now I'm trying to execute in Kubuntu, however, that does not execute, with Dotnet CLI threw this 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: liblibSkiaSharp: cannot open shared object file: 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 UI.Tests.Program.Main(String[] args) in /home/piero/Escritorio/AuraDev/Aura.UI/Tests/UI.Tests/Program.cs:line 14

And the debug with Rider EAP 2020.3:

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: liblibSkiaSharp: cannot open shared object file: 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 UI.Tests.Program.Main(String[] args) in /home/piero/Escritorio/AuraDev/Aura.UI/Tests/UI.Tests/Program.cs:line 14

System details:

OS: Kubuntu 20.5 with KDE Plasma 5 CPU: Intel Core i7 8565U (4 cores / 8 threads) GPU: Intel UHD Graphics 620 Net Core 3.1.8

Really, I don't know the problem, in windows there isn't anything

FrankenApps commented 3 years ago

I am not sure, but it might be related to this Issue

kekekeks commented 3 years ago

Check the output of ldd /path/to/libSkiaSharp.so

PieroCastillo commented 3 years ago

I downloaded libSkiaSharp.so and..., When should I put that?, I never work with libs in kubuntu

rstm-sf commented 3 years ago

I downloaded libSkiaSharp.so and..., When should I put that?, I never work with libs in kubuntu

Check f.e ./bin/Debug/netcoreapp3.1/runtimes/linux-x64/native/libSkiaSharp.so

PieroCastillo commented 3 years ago

I downloaded libSkiaSharp.so and..., When should I put that?, I never work with libs in kubuntu

Check f.e ./bin/Debug/netcoreapp3.1/runtimes/linux-x64/native/libSkiaSharp.so

really, I don't know what's happen, there is that file, but doesn't work the project image

rstm-sf commented 3 years ago

Perhaps the problem is in other dependencies, so you were asked to run the command

Check the output of ldd /path/to/libSkiaSharp.so

PieroCastillo commented 3 years ago

Perhaps the problem is in other dependencies, so you were asked to run the command

Check the output of ldd /path/to/libSkiaSharp.so

this should be the correct output?

piero@piero-Lenovo-IdeaPad-S340-15IWL:~/Escritorio/AuraDev/Aura.UI/Tests/UI.Tests/bin/Debug/netcoreapp3.1/runtimes/linux-x64/native$ ldd libSkiaSharp.so
        linux-vdso.so.1 (0x00007fff25152000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff46d6fb000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ff46d6f5000)
        libfontconfig.so.1 => /lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007ff46d6ae000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ff46d55f000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff46d36d000)
        /lib64/ld-linux-x86-64.so.2 (0x00007ff46e17d000)
        libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007ff46d2ae000)
        libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007ff46d27e000)
        libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007ff46d275000)
        libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007ff46d23d000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007ff46d221000)
kekekeks commented 3 years ago

/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 --verify /path/to/libSkiaSharp.so /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 --list /path/to/libSkiaSharp.so

Also show yours deps.json

danwalmsley commented 3 years ago

@kekekeks @PieroCastillo are you missing Avalonia.Skia.Linux.Natives package?

PieroCastillo commented 3 years ago

/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 --verify /path/to/libSkiaSharp.so /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 --list /path/to/libSkiaSharp.so

Also show yours deps.json

UI.Tests.deps.json.txt

this is the file (I changed the file extension to comment here)

PieroCastillo commented 3 years ago

@kekekeks @PieroCastillo are you missing Avalonia.Skia.Linux.Natives package?

throw an exception, that package uses SkiaSharp 1.68, however Avalonia 0.10 uses SkiaSharp 2.68

Gillibald commented 3 years ago

https://www.nuget.org/packages/SkiaSharp.NativeAssets.Linux/ is the correct package

rstm-sf commented 3 years ago

Isn't Avalonia using it?

https://github.com/AvaloniaUI/Avalonia/blob/c575283ae3f128523744843f321ce93a6da02c2b/build/SkiaSharp.props#L4

PieroCastillo commented 3 years ago

well, thanks!, I modified some files and I reinstalled dotnet, now that works without problems.