-
Notifications
You must be signed in to change notification settings - Fork 736
[CI] Enable Native AOT for Cli on linux-arm64, and linux-musl-x64 #10663
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
Conversation
These are cross compiled on linux-x64 images. Authored by Alexander Köplinger <[email protected]>
… that the native binary is for the correct arch
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.
Pull Request Overview
This PR enables Native AOT compilation for the Aspire CLI on linux-arm64 and linux-musl-x64 platforms by setting up cross-compilation infrastructure and adding binary validation checks.
- Configures cross-compilation containers and build environment for ARM64 and musl targets
- Adds linker arguments and file signature validation to ensure correct native binary generation
- Removes previous limitations that disabled Native AOT for these platforms
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/Aspire.Cli/Aspire.Cli.csproj |
Adds linker arguments for linux-musl-x64 cross-compilation |
eng/pipelines/templates/build_sign_native.yml |
Configures container selection for cross-compilation builds |
eng/pipelines/azure-pipelines.yml |
Defines cross-compilation containers with appropriate environments |
eng/clipack/Common.projitems |
Implements file signature validation for native binaries on Unix platforms |
eng/clipack/Aspire.Cli.osx-x64.csproj |
Adds file signature regex for macOS x64 binaries |
eng/clipack/Aspire.Cli.osx-arm64.csproj |
Adds file signature regex for macOS ARM64 binaries |
eng/clipack/Aspire.Cli.linux-x64.csproj |
Adds file signature regex for Linux x64 binaries |
eng/clipack/Aspire.Cli.linux-musl-x64.csproj |
Enables Native AOT and adds file signature regex for musl x64 |
eng/clipack/Aspire.Cli.linux-arm64.csproj |
Enables Native AOT and adds file signature regex for ARM64 |
|
/backport to release/9.4 |
|
Started backporting to release/9.4: https://github.com/dotnet/aspire/actions/runs/16511371828 |
| </PropertyGroup> | ||
|
|
||
| <ItemGroup Condition="'$(PublishAot)' == 'true'"> | ||
| <LinkerArg Condition="'$(RuntimeIdentifier)' == 'linux-musl-x64'" Include="--target=x86_64-alpine-linux-musl" /> |
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.
Why is this necessary? This doesn't seem right that we have to do this.
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.
IIUC, this is fixed in net9.0 but Aspire.Cli targets net8.0 . cc @akoeplinger
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.
We should find a time to update to net10.0. I started in #10167. Maybe when .NET 10 RC (or maybe preview7?) comes out, it would be a good time to switch to the latest. Advantages:
- I noticed a decent disk size drop when I was trying it.
- It would allow us to do "warnings as errors", which was also fixed in net9.0.
- We could do RID-specific
dotnet tool(dnx). So the AOT'd version would be indotnet tool install
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.
Would that mean that we could no longer publish a dotnet tool that is installable in 8 or 9 SDKs though?
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.
( not saying that would be ab locker, just trying to understand the implications)
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.
Would that mean that we could no longer publish a dotnet tool that is installable in 8 or 9 SDKs though?
Potentionally, yes.
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 thats is the case
cc @baronfel
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.
Why is this necessary? This doesn't seem right that we have to do this.
FWIW this was fixed in dotnet/runtime#101213, looks like there's an LLVM bug asking why this is needed.
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.
Would that mean that we could no longer publish a dotnet tool that is installable in 8 or 9 SDKs though?
Yes, or at minimum you could publish a 8/9 to but it would need to be a different package id.
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.
@MichalStrehovsky FYI that's not really the issue here, the problem is that in 8.0 we only consider a cross build if the architecture doesn't match: https://github.com/dotnet/runtime/blob/43906bfc26e75a36b1e317211a085f2886862f1e/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets#L35
But in this case we're cross-building from AzureLinux x64 -> Alpine Musl x64. Passing the linker flag directly works around that.
These are cross compiled on linux-x64 images.
Co-authored by Alexander Köplinger [email protected]
Add a check for the output of 'file' command on unix, to confirm that the native binary is for the correct arch. This is meant as a simply sanity check.
Contributes to #10288