-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[NativeAOT] Remove linux-arm as a supported RID in .NET8
#102072
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
[NativeAOT] Remove linux-arm as a supported RID in .NET8
#102072
Conversation
|
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas |
|
/cc: @simonrozsival |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think that this is the right fix
| <ItemGroup> | ||
| <!-- The officially-supported subset of these RIDs should be included in ILCompilerSupportedRids in | ||
| https://github.com/dotnet/installer/blob/main/src/redist/targets/GenerateBundledVersions.targets --> | ||
| <OfficialBuildRID Include="linux-arm" Platform="arm" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This lists all packages that may possibly exists.
linux-arm is not the only package that is not officially shipping. freebsd later in this list is not officially shipping either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the key here is that nobody will have freebsd in their RuntimeIdentifiers because nothing will restore with that in the RuntimeIdentifiers list (even if we take native AOT out of the picture completely, like I did in the below):
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;freebsd-x64</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<SelfContained>true</SelfContained>
</PropertyGroup>
</Project>Running dotnet publish on this:
D:\restoreerror>dotnet publish -bl
D:\restoreerror\restoreerror.csproj : error NU1101: Unable to find package Microsoft.NETCore.App.Runtime.freebsd-x64. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, NET8, nuget.org
D:\restoreerror\restoreerror.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.App.Runtime.freebsd-x64. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, NET8, nuget.org
D:\restoreerror\restoreerror.csproj : error NU1101: Unable to find package Microsoft.NETCore.App.Host.freebsd-x64. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, NET8, nuget.org
Restore failed with 3 error(s) in 1.4s
Now if we put native AOT back in the picture and try with a RID that is properly annotated as non-existent:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;win-x86</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>Try that:
D:\restoreerror>dotnet publish -bl
Restore complete (0.5s)
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
restoreerror succeeded (3.4s) → bin\Release\net8.0\win-x64\publish\
Build succeeded in 4.1s
Note this succeeded even though win-x86 doesn't work in .NET 8.
And now try with the bad one that is getting addressed here;
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;linux-arm</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>This results in:
D:\restoreerror>dotnet publish -bl
D:\restoreerror\restoreerror.csproj : error NU1103:
Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.2)
- Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]
- Found 0 version(s) in Microsoft Visual Studio Offline Packages
- Found 0 version(s) in C:\Program Files\dotnet\library-packs
- Found 0 version(s) in NET8
Restore failed with 1 error(s) in 1.6s
I think this fix is good and complete given NuGet's odd behaviors (I don't get why it needs to restore RIDs we're not building, but this behavior is not native AOT specific).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you both.
I will investigate this further.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NuGet's odd behaviors (I don't get why it needs to restore RIDs we're not building
Isn't the whole purpose of RuntimeIdentifiers to tell NuGet the list of RIDs that you plan to build for, so that you can run a single restore and then build for multiple RIDs without redoing the restore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW the presence of runtime.json makes NuGet Restore try to merge runtimes defined for Microsoft.DotNet.ILCompiler which I think causes the restore to fail (notice the: Merging in runtimes defined in package/Microsoft.DotNet.ILCompiler 8.0.2.).
For project:
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifiers>osx-arm64;linux-arm</RuntimeIdentifiers>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
</PropertyGroup>
Built with: dotnet publish
Restoring packages for /Users/ivan/tmp/naot_rids/naot_rids.csproj...
Restoring packages for .NETCoreApp,Version=v8.0...
Resolving conflicts for net8.0...
Scanning packages for runtime.json files...
Merging in runtimes defined in package/Microsoft.DotNet.ILCompiler 8.0.2.
Restoring packages for net8.0/linux-arm...
Restoring packages for net8.0/osx-arm64...
Resolving conflicts for net8.0/osx-arm64...
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Algorithms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Algorithms.dll, MVID: 01b05f88-ddd1-481c-a82c-7cf815ec6308, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Primitives, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Primitives.dll, MVID: 5969dcae-99a3-40d5-9227-3330c81a8815, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Runtime.Serialization.Formatters, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Runtime.Serialization.Formatters.dll, MVID: 4014afb0-9078-4651-b39d-7ba50fba2edc, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Diagnostics.TraceSource, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Diagnostics.TraceSource.dll, MVID: e641c01b-b934-4762-b8e0-c746319635ff, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Data.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Data.Common.dll, MVID: 7f8f6503-7ea7-4c77-84de-bcde27273caa, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.ComponentModel, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.ComponentModel.dll, MVID: e92d0acc-26bc-4c82-85da-ffa2f4743b9c, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): Anonymously Hosted DynamicMethods Assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null (location: , MVID: d6dae581-dca2-42b0-8b60-c45bb1b744cf, AssemblyLoadContext: Default)
CACHE https://api.nuget.org/v3-flatcontainer/runtime.linux-arm.microsoft.dotnet.ilcompiler/index.json
Resolving conflicts for net8.0/linux-arm...
1>/Users/ivan/tmp/naot_rids/naot_rids.csproj : error NU1103: Unable to find a stable package runtime.linux-arm.Microsoft.DotNet.ILCompiler with version (>= 8.0.2)
/Users/ivan/tmp/naot_rids/naot_rids.csproj : error NU1103: - Found 3 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24080.9 ]
/Users/ivan/tmp/naot_rids/naot_rids.csproj : error NU1103: - Found 0 version(s) in /usr/local/share/dotnet/library-packs
while when I remove the entry for linux-arm (or completely remove runtime.json) the restore succeeds.
Restoring packages for .NETCoreApp,Version=v8.0...
Resolving conflicts for net8.0...
Scanning packages for runtime.json files...
Restoring packages for net8.0/linux-arm...
Resolving conflicts for net8.0/linux-arm...
Restoring packages for net8.0/osx-arm64...
Resolving conflicts for net8.0/osx-arm64...
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Net.Http, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Net.Http.dll, MVID: d15a0545-b86a-46a0-841b-8f1dd4433417, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Algorithms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Algorithms.dll, MVID: 01b05f88-ddd1-481c-a82c-7cf815ec6308, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Security.Cryptography.Primitives, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Security.Cryptography.Primitives.dll, MVID: 5969dcae-99a3-40d5-9227-3330c81a8815, AssemblyLoadContext: Default)
CACHE https://api.nuget.org/v3/vulnerabilities/index.json
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Runtime.Serialization.Formatters, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Runtime.Serialization.Formatters.dll, MVID: 4014afb0-9078-4651-b39d-7ba50fba2edc, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Text.Encodings.Web, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Text.Encodings.Web.dll, MVID: 9fc1299c-c5e0-4fa8-9504-79550313bec2, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Runtime.Intrinsics, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Runtime.Intrinsics.dll, MVID: 8bbeaa60-2722-4527-be01-8b072b37ce67, AssemblyLoadContext: Default)
CACHE https://api.nuget.org/v3-vulnerabilities/2024.05.11.01.16.50/vulnerability.base.json
CACHE https://api.nuget.org/v3-vulnerabilities/2024.05.11.01.16.50/2024.05.13.07.16.55/vulnerability.update.json
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Diagnostics.TraceSource, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Diagnostics.TraceSource.dll, MVID: e641c01b-b934-4762-b8e0-c746319635ff, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.Data.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.Data.Common.dll, MVID: 7f8f6503-7ea7-4c77-84de-bcde27273caa, AssemblyLoadContext: Default)
Assembly loaded during TaskRun (NuGet.Build.Tasks.RestoreTask): System.ComponentModel, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/9.0.0-preview.3.24172.9/System.ComponentModel.dll, MVID: e92d0acc-26bc-4c82-85da-ffa2f4743b9c, AssemblyLoadContext: Default)
All packages and projects are compatible with net8.0.
All packages and projects are compatible with net8.0 (linux-arm).
All packages and projects are compatible with net8.0 (osx-arm64).
Committing restore...
This happens somewhere around: https://github.com/NuGet/NuGet.Client/blob/78c8c0fddd17dbf23e110c44ea1455f49e50363f/src/NuGet.Core/NuGet.Commands/RestoreCommand/ProjectRestoreCommand.cs#L458 and I am not super familiar with the code, but I suppose the build should probably bail out earlier than this.
|
I believe we've hit this before with <PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<PublishAot>true</PublishAot>
</PropertyGroup>My recollection is that we suggested users condition the PublishAot property to fix this, i.e. <PropertyGroup Condition="'$(TargetFramework)' != 'net6.0'">true</PropertyGroup>I don't know if there's a better alternative. |
|
The plan of this was to try to find a real fix for 8.0, assuming it's possible. |
Ok, I see why this helps with the linux-arm case in .NET 8. It is not a generic solution for the underlying problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. we will take for consideration in 8.0.x
Customer Impact
In .NET8
linux-armis incorrectly listed as the officially supported RID with NativeAOT:runtime/src/installer/pkg/projects/Microsoft.DotNet.ILCompiler/ILCompilerRIDs.props
Line 5 in 8966d08
Restoreas NuGet will not be able to find the required runtime package.IMPORTANT: This does not impact .NET9 as we now do have support for
linux-arm.The customer issue - mobile scenario
In #100929 customer reported build failures when trying out NativeAOT deployments with their MAUI apps targeting iOS platforms with .NET8 from Visual Studio.
The project build fails during the
Restoretarget with the following error:The internal find - desktop scenario
The same issue can occur with the following set up:
Project file:
Build with:
Fails with:
Regression
As @MichalStrehovsky noted this seems to be a left over from: dotnet/runtimelab#1530 and was not discovered until now.
Testing
Manually verified that by removing the
linux-armentry from:~/.nuget/packages/microsoft.dotnet.ilcompiler/8.0.2/runtime.jsonwhich is a file generated fromILCompilerRIDs.propsfixes the issue and the project builds properly.Risk
Low.
Fixes #100929