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

Compiling on m1 arm64 yields x64 app #4475

Closed
YVbakker opened this issue Feb 2, 2022 · 6 comments
Closed

Compiling on m1 arm64 yields x64 app #4475

YVbakker opened this issue Feb 2, 2022 · 6 comments
Assignees
Labels
area-setup Installation, setup, requirements, maui-check, workloads, platform support partner/macios Issues for the Mac / iOS SDK platform/macOS 🍏 macOS / Mac Catalyst s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
Milestone

Comments

@YVbakker
Copy link

YVbakker commented Feb 2, 2022

Description

When starting a new project as described in the installation manual, upon executing dotnet build -t:Run -f net6.0-maccatalyst an application spins up. Upon closer inspection, this seems to be an x86_64 executable.

Running dotnet build -t:Run -f net6.0-maccatalyst --use-current-runtime or dotnet build -t:Run -f net6.0-maccatalyst -r osx.12-arm64 (rid obtained from: https://docs.microsoft.com/en-us/dotnet/core/rid-catalog#macos-rids) produces an error message:

/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/15.2.200-preview.12.4/targets/Xamarin.Shared.Sdk.targets(1233,3): error : The RuntimeIdentifier 'osx-arm64' is invalid. [/Users/yvbakker/Development/maui-preview-12/MyMauiApp/MyMauiApp.csproj]

respectively

/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/15.2.200-preview.12.4/targets/Xamarin.Shared.Sdk.targets(1233,3): error : The RuntimeIdentifier 'osx.12-arm64' is invalid. [/Users/yvbakker/Development/maui-preview-12/MyMauiApp/MyMauiApp.csproj]

While maui is usable on the latest macos with an m1 chip, the fact that it's producing a non-native application by default does have a performance / time penalty which significantly slows the development process. I am aware that this framework is currently very experimental, and I'm using it only in this context.

Steps to Reproduce

  1. On macos 12, with an m1 chip (arm64), run dotnet new maui -n "MyMauiApp"
  2. Run dotnet build -t:Run -f net6.0-maccatalyst
  3. Inspect the running application with Activity Monitor or observe the output MyMauiApp -> /.../MyMauiApp/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/MyMauiApp.dll

Version with bug

Preview 12 (current)

Last version that worked well

Unknown/Other

Affected platforms

macOS

Affected platform versions

MacOS 12.2

Did you find any workaround?

Compiling (by default) for x64 works fine, it launches through rosetta.

Relevant log output

No response

@YVbakker YVbakker added the t/bug Something isn't working label Feb 2, 2022
@jsuarezruiz jsuarezruiz added this to New in Triage via automation Feb 2, 2022
@jsuarezruiz jsuarezruiz added the area-setup Installation, setup, requirements, maui-check, workloads, platform support label Feb 2, 2022
@gdar91
Copy link

gdar91 commented Feb 14, 2022

Install rosetta 2 and try running it in release mode dotnet build -t:Run -f net6.0-maccatalyst -c Release. Hope we get native M1 support very soon.

@YVbakker
Copy link
Author

Install rosetta 2 and try running it in release mode dotnet build -t:Run -f net6.0-maccatalyst -c Release. Hope we get native M1 support very soon.

I have rosetta 2 installed, and it runs just fine, thank you though. This issue is about the fact that there is no native executable produced even though the target is available (it seems). So far I haven't been able to configure the compiler to use this target.

@kristinx0211 kristinx0211 added the s/verified Verified / Reproducible Issue ready for Engineering Triage label Mar 17, 2022
@kristinx0211
Copy link

installed rosetta 2, Maui project can be build and run succeeded on m1 mac.

@Redth Redth added this to the 6.0.300 milestone Mar 22, 2022
@Redth Redth added the partner/macios Issues for the Mac / iOS SDK label Mar 22, 2022
@Redth
Copy link
Member

Redth commented Mar 22, 2022

@rolfbjarne is this perhaps due to incorrect RID defaults being assumed? This might be fixed already?

@rolfbjarne
Copy link
Member

We always default to maccatalyst-x64 as the RID for Mac Catalyst (and macOS), we don't look at the host OS.

This is to get predictable behavior between machines: one scenario we had in mind was CI machines, when you might add a new machine to your pool of machines, and most people wouldn't expect the resulting app to change.

If you want to build for ARM64, you have to specify the maccatalyst-arm64 RID.

Due to a different bug, that's not trivial for MAUI projects (dotnet/sdk#21877), but you can always set it in the csproj:

<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0-maccatalyst'">
    <RuntimeIdentifier>maccatalyst-arm64</RuntimeIdentifier>
</PropertyGroup>

@Redth
Copy link
Member

Redth commented Mar 23, 2022

I suppose that as long as the ide infers an appropriate rid based on the host it makes sense to keep the x64 default for Cli.

@Redth Redth closed this as completed Mar 23, 2022
Triage automation moved this from New to Done Mar 23, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Apr 22, 2022
@samhouts samhouts added the platform/macOS 🍏 macOS / Mac Catalyst label Feb 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-setup Installation, setup, requirements, maui-check, workloads, platform support partner/macios Issues for the Mac / iOS SDK platform/macOS 🍏 macOS / Mac Catalyst s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
No open projects
Development

No branches or pull requests

7 participants