question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Run MAUI app on M1 Mac without Rosetta 2

See original GitHub issue

Description

I am trying to run a MAUI app on my M1 MacBook Pro. I don’t have Rosetta 2 installed and when running dotnet new maui && dotnet build -t:Run -f net6.0-maccatalyst I get the following error:

An error occurred trying to start process '/usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.maccatalyst-x64/6.0.1/Sdk/../tools/mono-aot-cross' with working directory '/Users/collin/Programmieren/dotNET/babi-desktop'. Bad CPU type in executable

It seems like MAUI doesn’t support the ARM architecture. Is this true?

Steps to Reproduce

  1. Create a new MAUI project on a Mac with an M1 processor (e.g. with dotnet new maui)
  2. Run it (dotnet build -t:Run -f net6.0-maccatalyst)

Version with bug

Preview 12 (current)

Last version that worked well

Unknown/Other

Affected platforms

macOS, I was not able test on other platforms

Affected platform versions

macOS 12.1

Did you find any workaround?

Install Rosetta 2.

Relevant log output

/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.0.101-preview.11.551/targets/Xamarin.Shared.Sdk.targets(898,3): error MSB4018: The "AOTCompile" task failed unexpectedly. [/Users/collin/Programmieren/dotNET/babi-desktop/babi-desktop.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.0.101-preview.11.551/targets/Xamarin.Shared.Sdk.targets(898,3): error MSB4018: System.AggregateException: One or more errors occurred. (One or more errors occurred. (An error occurred trying to start process '/usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.maccatalyst-x64/6.0.1/Sdk/../tools/mono-aot-cross' with working directory '/Users/collin/Programmieren/dotNET/babi-desktop'. Bad CPU type in executable)) [/Users/collin/Programmieren/dotNET/babi-desktop/babi-desktop.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.0.101-preview.11.551/targets/Xamarin.Shared.Sdk.targets(898,3): error MSB4018:  ---> System.AggregateException: One or more errors occurred. (An error occurred trying to start process '/usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.maccatalyst-x64/6.0.1/Sdk/../tools/mono-aot-cross' with working directory '/Users/collin/Programmieren/dotNET/babi-desktop'. Bad CPU type in executable) [/Users/collin/Programmieren/dotNET/babi-desktop/babi-desktop.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.0.101-preview.11.551/targets/Xamarin.Shared.Sdk.targets(898,3): error MSB4018:  ---> System.ComponentModel.Win32Exception (86): An error occurred trying to start process '/usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.maccatalyst-x64/6.0.1/Sdk/../tools/mono-aot-cross' with working directory '/Users/collin/Programmieren/dotNET/babi-desktop'. Bad CPU type in executable [/Users/collin/Programmieren/dotNET/babi-desktop/babi-desktop.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.0.101-preview.11.551/targets/Xamarin.Shared.Sdk.targets(898,3): error MSB4018:    at System.Diagnostics.Process.ForkAndExecProcess(ProcessStartInfo startInfo, String resolvedFilename, String[] argv, String[] envp, String cwd, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec) [/Users/collin/Programmieren/dotNET/babi-desktop/babi-desktop.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.0.101-preview.11.551/targets/Xamarin.Shared.Sdk.targets(898,3): error MSB4018:    at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo) [/Users/collin/Programmieren/dotNET/babi-desktop/babi-desktop.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.0.101-preview.11.551/targets/Xamarin.Shared.Sdk.targets(898,3): error MSB4018:    at System.Diagnostics.Process.Start() [/Users/collin/Programmieren/dotNET/babi-desktop/babi-desktop.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.0.101-preview.11.551/targets/Xamarin.Shared.Sdk.targets(898,3): error MSB4018:    at Xamarin.Utils.Execution.<>c__DisplayClass24_1.<RunAsync>b__0() in /Users/builder/azdo/_work/1/s/xamarin-macios/tools/common/Execution.cs:line 103 [/Users/collin/Programmieren/dotNET/babi-desktop/babi-desktop.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.0.101-preview.11.551/targets/Xamarin.Shared.Sdk.targets(898,3): error MSB4018: --- End of stack trace from previous location --- [/Users/collin/Programmieren/dotNET/babi-desktop/babi-desktop.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.0.101-preview.11.551/targets/Xamarin.Shared.Sdk.targets(898,3): error MSB4018:    at Xamarin.MacDev.Tasks.XamarinTask.ExecuteAsync(String fileName, IList`1 arguments, String sdkDevPath, Dictionary`2 environment, Boolean mergeOutput, Boolean showErrorIfFailure, String workingDirectory) in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/XamarinTask.cs:line 96 [/Users/collin/Programmieren/dotNET/babi-desktop/babi-desktop.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.0.101-preview.11.551/targets/Xamarin.Shared.Sdk.targets(898,3): error MSB4018:    --- End of inner exception stack trace --- [/Users/collin/Programmieren/dotNET/babi-desktop/babi-desktop.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.0.101-preview.11.551/targets/Xamarin.Shared.Sdk.targets(898,3): error MSB4018:    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) [/Users/collin/Programmieren/dotNET/babi-desktop/babi-desktop.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.0.101-preview.11.551/targets/Xamarin.Shared.Sdk.targets(898,3): error MSB4018:    at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) [/Users/collin/Programmieren/dotNET/babi-desktop/babi-desktop.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.0.101-preview.11.551/targets/Xamarin.Shared.Sdk.targets(898,3): error MSB4018:    at System.Threading.Tasks.Task`1.get_Result() [/Users/collin/Programmieren/dotNET/babi-desktop/babi-desktop.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.0.101-preview.11.551/targets/Xamarin.Shared.Sdk.targets(898,3): error MSB4018:    at Xamarin.MacDev.Tasks.AOTCompileTaskBase.<>c__DisplayClass32_0.<Execute>b__6(Task`1 v) in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/AOTCompileTaskBase.cs:line 102 [/Users/collin/Programmieren/dotNET/babi-desktop/babi-desktop.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.0.101-preview.11.551/targets/Xamarin.Shared.Sdk.targets(898,3): error MSB4018:    at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke() [/Users/collin/Programmieren/dotNET/babi-desktop/babi-desktop.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.0.101-preview.11.551/targets/Xamarin.Shared.Sdk.targets(898,3): error MSB4018:    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) [/Users/collin/Programmieren/dotNET/babi-desktop/babi-desktop.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.0.101-preview.11.551/targets/Xamarin.Shared.Sdk.targets(898,3): error MSB4018: --- End of stack trace from previous location --- [/Users/collin/Programmieren/dotNET/babi-desktop/babi-desktop.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.0.101-preview.11.551/targets/Xamarin.Shared.Sdk.targets(898,3): error MSB4018:    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) [/Users/collin/Programmieren/dotNET/babi-desktop/babi-desktop.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.0.101-preview.11.551/targets/Xamarin.Shared.Sdk.targets(898,3): error MSB4018:    --- End of inner exception stack trace --- [/Users/collin/Programmieren/dotNET/babi-desktop/babi-desktop.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.0.101-preview.11.551/targets/Xamarin.Shared.Sdk.targets(898,3): error MSB4018:    at System.Threading.Tasks.Task.WaitAllCore(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken) [/Users/collin/Programmieren/dotNET/babi-desktop/babi-desktop.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.0.101-preview.11.551/targets/Xamarin.Shared.Sdk.targets(898,3): error MSB4018:    at System.Threading.Tasks.Task.WaitAll(Task[] tasks) [/Users/collin/Programmieren/dotNET/babi-desktop/babi-desktop.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.0.101-preview.11.551/targets/Xamarin.Shared.Sdk.targets(898,3): error MSB4018:    at Xamarin.MacDev.Tasks.AOTCompileTaskBase.Execute() in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/AOTCompileTaskBase.cs:line 109 [/Users/collin/Programmieren/dotNET/babi-desktop/babi-desktop.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.0.101-preview.11.551/targets/Xamarin.Shared.Sdk.targets(898,3): error MSB4018:    at Xamarin.MacDev.Tasks.AOTCompile.Execute() in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.MacDev.Tasks/Tasks/AOTCompile.cs:line 16 [/Users/collin/Programmieren/dotNET/babi-desktop/babi-desktop.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.0.101-preview.11.551/targets/Xamarin.Shared.Sdk.targets(898,3): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/Users/collin/Programmieren/dotNET/babi-desktop/babi-desktop.csproj]
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.0.101-preview.11.551/targets/Xamarin.Shared.Sdk.targets(898,3): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/Users/collin/Programmieren/dotNET/babi-desktop/babi-desktop.csproj]

Depends on

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
CollinAlpertcommented, Feb 3, 2022

@YVbakker I saw that issue, but in my case, I can’t even build.

0reactions
eerhardtcommented, Aug 18, 2022

In case anyone comes across this issue because they are seeing:

The “AOTCompile” task failed unexpectedly (An error occurred trying to start process ‘/usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.maccatalyst-arm64/6.0.8/Sdk/…/tools/mono-aot-cross’ with working directory ‘XXXX’. Bad CPU type in executable)

You need to install Rosetta on an M1 Mac in order to build an iOS app. See https://github.com/dotnet/runtime/issues/74175 for the issue tracking enabling building natively on arm64.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Which Macbook to get for MAUI iOs development?
I'd vote for a Mac Mini M2, for price/performance. And I can confirm that VS Mac runs natively on Apple silicon (no Rosetta)....
Read more >
Getting started with .NET MAUI (iOS) on an M1 Mac.
1. Install macOS Arm64 .NET SDK on M1 Mac. · 2. Install . · 3. Create a new folder and a new MAUI...
Read more >
Setting Up an M1 Mac for Xamarin Development
Looking to get an M1 Mac or just got one for Xamarin development? Here is what you need to know to get iOS...
Read more >
Pair to Mac for iOS development - .NET MAUI
Learn how to use Pair to Mac to connect Visual Studio 2022 to a Mac build host. This article discusses how to enable...
Read more >
Building Beautiful Apps for Mac Using .NET MAUI - YouTube
NET MAUI support for Visual Studio 2022 for Mac is in preview! Join Elizabeth Hare for a tour of the new VS Mac...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found