[Bug] .NET MAUI projects do not build on Apple M1
See original GitHub issueDescription
dotnet new maui
then dotnet build
fails on my M1 with:
Unhandled exception. System.TypeInitializationException: The type initializer for 'SkiaSharp.SKObject' threw an exception.
---> System.DllNotFoundException: Unable to load library 'libSkiaSharp'.
If I check some of the native libraries, they are missing arm64 architectures, such as libSkiaSharp.dylib
:
file /usr/local/share/dotnet/packs/Microsoft.Maui.Resizetizer.Sdk/6.0.100-preview.6.1003+sha.5c159aabf-azdo.4977641/targets/libSkiaSharp.dylib
/usr/local/share/dotnet/packs/Microsoft.Maui.Resizetizer.Sdk/6.0.100-preview.6.1003+sha.5c159aabf-azdo.4977641/targets/libSkiaSharp.dylib: Mach-O universal binary with 1 architecture: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64]
/usr/local/share/dotnet/packs/Microsoft.Maui.Resizetizer.Sdk/6.0.100-preview.6.1003+sha.5c159aabf-azdo.4977641/targets/libSkiaSharp.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
Then also libHarfBuzzSharp.dylib
:
file /usr/local/share/dotnet/packs/Microsoft.Maui.Resizetizer.Sdk/6.0.100-preview.6.1003+sha.5c159aabf-azdo.4977641/targets/libHarfBuzzSharp.dylib
/usr/local/share/dotnet/packs/Microsoft.Maui.Resizetizer.Sdk/6.0.100-preview.6.1003+sha.5c159aabf-azdo.4977641/targets/libHarfBuzzSharp.dylib: Mach-O universal binary with 1 architecture: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64]
/usr/local/share/dotnet/packs/Microsoft.Maui.Resizetizer.Sdk/6.0.100-preview.6.1003+sha.5c159aabf-azdo.4977641/targets/libHarfBuzzSharp.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
What we’re doing in xamarin-android is merging several architectures into a single .dylib:
Expected Behavior
I can build .NET MAUI apps on an Apple M1.
Actual Behavior
Some native libraries are missing arm64 architectures.
Basic Information
dotnet --version
6.0.100-preview.6.21355.2
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
BUILD Error NETSDK1147 on Apple M1 · Issue #101
Hello I get the following errors with this command dotnet build HelloMaui -t:Run -f net6.0-ios. Error:
Read more >Net Maui cant compile a fresh macos project
MAUI is not offical support for macOS yet as verion of 17.3 Visual studio. the most important is Pre-requisites your mac have to...
Read more >MAUI on Mac - Visual Studio 2022 17.4.2 : r/dotnetMAUI
I verified that this is not specific to my project by creating a new MAUI project on the Mac using the template and...
Read more >MAUI App launches fine in iOS Simulator, refuses to build ...
When I start building a default MAUI project for a physical iOS device on Visual Studio for Mac Preview 17.3 (build 191) on...
Read more >Setting up your Mac for .NET MAUI in 2023 | by Saurav Sahu
Go to the App Store and download the latest version of XCode. You DON'T need an Apple Developer Account. To run your app...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For the resizetizer stuff, I just need to bump SkiaSharp. 2.88 has arm64 support
Not sure what is being asked here?
I have an M1. My first goal was to get the Android workload working, because I’m on the Xamarin.Android team