Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run MAUI app on M1 Mac without Rosetta 2 #4476

Closed
3 tasks done
CollinAlpert opened this issue Feb 2, 2022 · 7 comments · Fixed by dotnet/runtime#89961
Closed
3 tasks done

Run MAUI app on M1 Mac without Rosetta 2 #4476

CollinAlpert opened this issue Feb 2, 2022 · 7 comments · Fixed by dotnet/runtime#89961
Assignees
Labels
area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging external partner/macios Issues for the Mac / iOS SDK partner/mono platform/macOS 🍏 macOS / Mac Catalyst s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@CollinAlpert
Copy link

CollinAlpert commented Feb 2, 2022

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

@CollinAlpert CollinAlpert added the t/bug Something isn't working label Feb 2, 2022
@YVbakker
Copy link

YVbakker commented Feb 2, 2022

possible duplicate / related to: #4475

@CollinAlpert
Copy link
Author

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

@Eilon Eilon added the area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging label Feb 10, 2022
@kristinx0211 kristinx0211 added the s/verified Verified / Reproducible Issue ready for Engineering Triage label Mar 17, 2022
@kristinx0211
Copy link

kristinx0211 commented Mar 17, 2022

vs 17.1 is bound with SDK arm64 6.0 & 3.1(x64), so must install Rosetta 2 first on m1 mac repro on M1 mac because of the SDK 3.1(x64) , if not install Rosetta 2, maui build is failing, after installed Rosetta 2, create and build all succeeded.
image
OS:
image

@CollinAlpert
Copy link
Author

@kristinx0211 Exactly, you need to install Rosetta 2 which is something I'd like to avoid.

@Redth
Copy link
Member

Redth commented Mar 22, 2022

Similar to #4475

@Redth Redth marked this as a duplicate of #4475 Mar 22, 2022
@Redth Redth closed this as completed Mar 22, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Apr 21, 2022
@eerhardt
Copy link
Member

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 dotnet/runtime#74175 for the issue tracking enabling building natively on arm64.

@samhouts samhouts reopened this Aug 2, 2023
@samhouts samhouts added partner/macios Issues for the Mac / iOS SDK external partner/mono labels Aug 2, 2023
@samhouts samhouts added this to the .NET 8 GA milestone Aug 2, 2023
@samhouts samhouts marked this as not a duplicate of #4475 Aug 2, 2023
steveisok pushed a commit to steveisok/runtime that referenced this issue Aug 3, 2023
…, and android where possible

As a result of dotnet#89027 and dotnet#74715, we can now build native arm64 cross compilers on linux and macos. This change adds the right references to the workload manifest so that they can be installed with maui and the mobile SDK's.

win-arm64 is the only arm64 platform left and that is a work in progress.

Contributes to dotnet#82495

Fixes dotnet/maui#4476
@samhouts samhouts reopened this Aug 4, 2023
@samhouts samhouts reopened this Aug 7, 2023
@samhouts
Copy link
Member

This should be resolved as of 8.0 RC2. Thanks!

@github-project-automation github-project-automation bot moved this from Todo to Done in MAUI SDK Ongoing Sep 13, 2023
@samhouts samhouts added the platform/macOS 🍏 macOS / Mac Catalyst label Feb 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging external partner/macios Issues for the Mac / iOS SDK partner/mono platform/macOS 🍏 macOS / Mac Catalyst s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
9 participants