runtime: [NativeAOT] cross-compiling to osx-arm64 from osx-x64 does not work

Reported by @lemonmojo in https://github.com/dotnet/runtime/issues/73678#issuecomment-1441488462:

I’m also running into the same error using .NET 8 Preview 1.

While cross-compiling to x64 from an M1 machine works fine for me, I can’t get the reverse (cross-compiling to ARM64 from an Intel machine) to work.

I’m not using any packages in this project. In fact, the issue is very easy to reproduce:

dotnet new classlib -n "AOTTest"
cd AOTTest
dotnet publish -p "PublishAot=true" -r osx-x64
dotnet publish -p "PublishAot=true" -r osx-arm64

Publishing using dotnet publish -r osx-x64 and dotnet publish -r osx-arm64 works fine from an M1 machine. While on an Intel machine only the x64 build works and the ARM64 one fails with the error message:

/Users/redacted/.nuget/packages/microsoft.dotnet.ilcompiler/8.0.0-preview.1.23110.8/build/Microsoft.NETCore.Native.Publish.targets(74,5): error : The PrivateSdkAssemblies ItemGroup is required for _ComputeAssembliesToCompileToNative [/Path/to/Project.csproj].

So here’s what works and what doesn’t work in my testing: ARM64 -> x64: OK ARM64 -> ARM64: OK x64 -> x64: OK x64 -> ARM64: Error

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 18 (17 by maintainers)

Most upvoted comments

I tested the fix with local build and it works, so I opened a PR.

I do have binlog from @lemonmojo and we troubleshoot that issue in #coreclr channel on dotnet evolution. Issue was that runtime package was not downloaded as part of restore(?) process. We solve that by manually adding package <PackageReference Include="runtime.osx-arm64.Microsoft.DotNet.ILCompiler" Version="8.0.0-preview.1.23110.8" />. Discrepancies in differences quite possible was because ARM64 -> x64: OK was first attemp, and ARM64 machine has runtime package in the cache already.