icsharpcode / AvaloniaILSpy

Avalonia-based .NET Decompiler (port of ILSpy)
1.52k stars 171 forks source link

M1 Support #83

Closed christophwille closed 2 years ago

christophwille commented 2 years ago

See https://github.com/actions/virtual-environments/issues/2187

We need GitHub Actions support (local building https://github.com/icsharpcode/AvaloniaILSpy/blob/master/ILSpy/ILSpy.csproj#L10 needs to be adjusted, but first #82 needs to be merged because M1 support is in .NET 6.0)

jeffreye commented 2 years ago

I just ordered a M1 MacBook, I'll pick this up next month

christophwille commented 2 years ago

I too should get an MBA soon for testing; could you take a look at #82 before? Should be innocous enough (binaries work nicely on Windows)

AraHaan commented 2 years ago

I have a 64 bit macbook pro from 2015 I can test it on. But I do not see why it would not work.

Also for M1 I think they are ARM64 only as well with apple wanting to basically eliminate normal x64 entirely eventually.

AraHaan commented 2 years ago

And it works on my Mac. 👌

christophwille commented 2 years ago

I have merged my PR #82 - I got my MBA M1 for testing now.

Edit: dotnet run doesn't like M1 out of the gate

Sorry, we crashed
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 DYLD_PRINT_LIBRARIES environment variable: dlopen(liblibSkiaSharp, 0x0001): tried: 'liblibSkiaSharp' (no such file), '/usr/local/lib/liblibSkiaSharp' (no such file), '/usr/lib/liblibSkiaSharp' (no such file), '/Users/christophw/GitWorkspace/AvaloniaILSpy/ILSpy/bin/Debug/net6.0/liblibSkiaSharp' (no such file), '/usr/local/lib/liblibSkiaSharp' (no such file), '/usr/lib/liblibSkiaSharp' (no such file)
   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) in /_/src/Skia/Avalonia.Skia/PlatformRenderInterface.cs:line 27
   at Avalonia.Skia.SkiaPlatform.Initialize(SkiaOptions options) in /_/src/Skia/Avalonia.Skia/SkiaPlatform.cs:line 20
   at Avalonia.SkiaApplicationExtensions.<>c__0`1.<UseSkia>b__0_0() in /_/src/Skia/Avalonia.Skia/SkiaApplicationExtensions.cs:line 20
   at Avalonia.Controls.AppBuilderBase`1.Setup() in /_/src/Avalonia.Controls/AppBuilderBase.cs:line 304
   at Avalonia.Controls.AppBuilderBase`1.SetupWithLifetime(IApplicationLifetime lifetime) in /_/src/Avalonia.Controls/AppBuilderBase.cs:line 179
   at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 174
   at ICSharpCode.ILSpy.Program.Main(String[] args) in /Users/christophw/GitWorkspace/AvaloniaILSpy/ILSpy/Program.cs:line 22
christophwille commented 2 years ago

I added the RID "osx-arm64" - that didn't change a thing; then in ILSpy.csproj I started adding SkiaSharp to override Avalonia's default version - each version https://www.nuget.org/packages/SkiaSharp/ gave a more detailled error message until I hit the one for libHarfBuzzSharp on version 2.88.0-preview.155 which seems to have been reported on SkiaSharp repo:

https://github.com/mono/SkiaSharp/issues/1829

Given that I am not an expert on any of those things (code signing on Apple, Skia or Avalonia) this is the beginning of investigations for somebody else.