-
Notifications
You must be signed in to change notification settings - Fork 516
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: Universal apps are not building correctly with NativeAOT #20903
Comments
/cc: @filipnavara |
ivanpovazan
changed the title
NativeAOT: Properly support macOS universal apps
NativeAOT: Universal apps are not building correctly with NativeAOT
Sep 23, 2024
rolfbjarne
pushed a commit
that referenced
this issue
Sep 23, 2024
#21288) ### Description When building universal apps with NativeAOT, the output path for the app bundle (and zipped .ipa) is incorrect when building with NativeAOT. For example publishing a MAUI template app with NativeAOT gives the following output (notice: `osx-arm64`): ``` Created the package: /Users/ivan/tmp/net9-rc1/MacCatRc1/bin/Release/net9.0-maccatalyst/osx-arm64/publish/MacCatRc1-1.0.pkg ``` and the following output tree: ``` bin/Release bin/Release/net9.0-maccatalyst bin/Release/net9.0-maccatalyst/maccatalyst-arm64/* bin/Release/net9.0-maccatalyst/maccatalyst-x64/* bin/Release/net9.0-maccatalyst/osx-arm64 bin/Release/net9.0-maccatalyst/osx-arm64/MacCatRc1.app/* bin/Release/net9.0-maccatalyst/osx-arm64/publish/* ``` The problem comes from the fact that .NET SDK for NativeAOT builds will try to resolve `RuntimeIdentifier` when it is not specified in: https://github.com/dotnet/sdk/blob/58eb155e30a393656dd290486143f02f958898fc/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets#L95-L114 which resolves to `osx-arm64` and gets later used to setup `IntermediateOutputPath` and `OutputPath` in: https://github.com/dotnet/sdk/blob/58eb155e30a393656dd290486143f02f958898fc/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets#L343-L346 However, this shouldn't be done in universal builds, as the outer build does not have the runtime identifier specified and should not be altered. ### Changes In this PR we are disabling the resolution of the `RuntimeIdentifier` when building universal apps with NativeAOT early in SDK in order to fix the output path. I also included unit tests to verify the existence of .app bundles. ### Follow-up There is an additional issue with Debug builds of universal apps with NativeAOT, where merging PDBs fails, which is reported in: #20903 --- Contributes to: #20903 --------- Co-authored-by: Ivan Povazan <[email protected]>
rolfbjarne
pushed a commit
that referenced
this issue
Sep 24, 2024
### Description Previously we were including .pdbs in NativeAOT debug bundles, which was causing issues with debug builds of universal apps (during app bundle merging). This does not seem to be required, as in debug builds NativeAOT compiler uses information from pdbs to provide more data about the managed code during native debugging (like line numbers in stack traces, etc), embedding it into the native image, and does not require presence of said files during runtime. ### Changes - This PR excludes pdbs from NativeAOT app bundles by removing them from `ResolvedFileToPublish` item group. - The relevant unit tests are reenabled. --- Fixes #20903
Fixed in #21291. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
It seems that we do not properly support building universal apps (
RuntimeIdentifiers=osx-arm64;osx-x64
ormaccatalyst-arm64;maccatalyst-x64
) with NativeAOT.There are issue with both
Debug
andRelease
configuration.Repro
dotnet new macos
Debug
and later inRelease
configuration via:dotnet publish -c <configuration>
Debug configuration
Publishing with NativeAOT in
Debug
configuration fails at app bundle merging and produces the following error:Release configuration
Publishing with NativeAOT succeeds in
Release
configuration but the universal app bundle is not present in the expected location (notice the runtime identifier in the path):The expected location (when building the same app with CoreCLR ie
PublishAot=false
) gives the bundle at:The text was updated successfully, but these errors were encountered: