Skip to content

Dogfooding instructions for .NET 8 NativeAOT on macOS x64 via Rosetta #79253

@christianscheuer

Description

@christianscheuer

We're extremely happy that NativeAOT on Mac x64/arm64 should now work in .NET 8 daily builds.
As one of the early proponents of CoreRT, we're looking forward to help beta test this in a large real world application.

However, I'm running into issues with using the .NET 8 daily builds of the SDK with ILC.
We need to build macOS universal binaries (eventually) so all of our builds of x64 are done via Rosetta 2 on an Apple Silicon device.

Here's the repro:
https://github.com/christianscheuer/nativeaot-net8

Steps:

  • I installed macOS x64 SDK version 8.0.100-alpha.1.22605.4 from github.com/dotnet/installer
  • All commands are run from a Rosetta Terminal.
  • The SDK host is x64, the SDK is x64.
  • Run ./build.sh which essentially just ensures we're in Rosetta, then runs dotnet publish -c Release -r osx-x64

Expected result:

  • It builds

Actual result:

MSBuild version 17.5.0-preview-22564-01+d14b74d6f for .NET
  Determining projects to restore...
  Restored /Users/chr/d/d2/nativeaot-net8/nativeaot-net8.csproj (in 327 ms).
/usr/local/share/dotnet/x64/sdk/8.0.100-alpha.1.22605.4/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.RuntimeIdentifierInference.targets(275,5): message NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy [/Users/chr/d/d2/nativeaot-net8/nativeaot-net8.csproj]
  nativeaot-net8 -> /Users/chr/d/d2/nativeaot-net8/bin/Release/net8.0/osx-x64/nativeaot-net8.dll
/Users/chr/.nuget/packages/microsoft.dotnet.ilcompiler/8.0.0-alpha.1.22559.2/build/Microsoft.DotNet.ILCompiler.SingleEntry.targets(51,5): warning : Delete explicit 'Microsoft.DotNet.ILCompiler' package reference in your project file. Explicit 'Microsoft.DotNet.ILCompiler' package reference can run into version errors. [/Users/chr/d/d2/nativeaot-net8/nativeaot-net8.csproj]
/Users/chr/.nuget/packages/microsoft.dotnet.ilcompiler/8.0.0-alpha.1.22559.2/build/Microsoft.NETCore.Native.Publish.targets(70,5): error : Add a PackageReference for 'runtime.osx-arm64.Microsoft.DotNet.ILCompiler' to allow cross-compilation for x64 [/Users/chr/d/d2/nativeaot-net8/nativeaot-net8.csproj]

What's weird is that it claims it can't do cross-compilation, which I'm not actually doing. This is the x64 SDK running in an x64 terminal trying to build an x64 release. Furthermore, it requests the arm64 PackageReference. Adding that reference changes nothing, it reports the same error. It also complains about an explicit package reference that I'm not seeing.

I tried following the instructions on dotnet/installer to add the Nuget.config, but that ends up in yet other errors.

I shared the output of dotnet --info below.

Is there anything I should do differently to consume and test .NET 8 NativeAOT for macOS x64?
Are there dogfooding instructions for this scenario somewhere that I haven't located?

`dotnet --info` output:
.NET SDK:
 Version:   8.0.100-alpha.1.22605.4
 Commit:    af14110139

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  12.5
 OS Platform: Darwin
 RID:         osx.12-x64
 Base Path:   /usr/local/share/dotnet/x64/sdk/8.0.100-alpha.1.22605.4/

Host:
  Version:      8.0.0-alpha.1.22559.2
  Architecture: x64
  Commit:       dd7fdb723d

.NET SDKs installed:
  5.0.408 [/usr/local/share/dotnet/x64/sdk]
  6.0.403 [/usr/local/share/dotnet/x64/sdk]
  8.0.100-alpha.1.22605.4 [/usr/local/share/dotnet/x64/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 5.0.17 [/usr/local/share/dotnet/x64/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.11 [/usr/local/share/dotnet/x64/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.0-alpha.1.22558.5 [/usr/local/share/dotnet/x64/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 5.0.17 [/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.11 [/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.0-alpha.1.22557.12 [/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.0-alpha.1.22559.2 [/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App]

Other architectures found:
  arm64 [/usr/local/share/dotnet]
    registered at [/etc/dotnet/install_location_arm64]

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

cc @jkotas

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions