Commit 0bb8d77
Fix missing static libraries in NativeAOT packs for Apple mobile platforms (#123274)
## Description
NativeAOT runtime packs for iOS and other Apple mobile platforms were
missing required static libraries (libSystem.Globalization.Native.a,
libSystem.IO.Compression.Native.a, libSystem.Native.a, libbrotli*.a)
starting in version 11.0.0-alpha.1.26065.101.
## Changes
Modified `eng/liveBuilds.targets` in the
`ResolveLibrariesRuntimeFilesFromLocalBuild` target:
- Added `BuildNativeAOTRuntimePack != 'true'` condition to the
`ExcludeNativeLibrariesRuntimeFiles` item for Apple mobile platforms
- Updated comment to clarify that the exclusion does not apply to
NativeAOT
**Rationale**: Regular CoreCLR packs retrieve these libraries from the
CoreCLR shared framework directory, so they're excluded from
LibrariesRuntimeFiles to avoid duplicates. NativeAOT packs do not reach
back into CoreCLR shared framework artifacts and require these libraries
from LibrariesRuntimeFiles.
```xml
<!-- Before -->
<ExcludeNativeLibrariesRuntimeFiles Condition="'$(TargetsAppleMobile)' == 'true' and '$(RuntimeFlavor)' == 'CoreCLR'"
<!-- After -->
<ExcludeNativeLibrariesRuntimeFiles Condition="'$(TargetsAppleMobile)' == 'true' and '$(RuntimeFlavor)' == 'CoreCLR' and '$(BuildNativeAOTRuntimePack)' != 'true'"
```
## Testing
The fix will be validated when NativeAOT runtime packs for Apple mobile
platforms are built in CI/CD, verifying that the static libraries are
included in the package output.
<!-- START COPILOT ORIGINAL PROMPT -->
<details>
<summary>Original prompt</summary>
>
> ----
>
> *This section details on the original issue you should resolve*
>
> <issue_title>Latest .NET 11 NativeAOT packs missing some static
libraries</issue_title>
> <issue_description>The `11.0.0-alpha.1.26065.101` version of the
`microsoft.netcore.app.runtime.nativeaot.ios-arm64` pack (and probably
other packs for other RIDs as well, I haven't checked) are missing the
following files:
>
> * libSystem.Globalization.Native.a
> * libSystem.IO.Compression.Native.a
> * libSystem.Native.a
> * libbrotlicommon.a
> * libbrotlidec.a
> * libbrotlienc.a
>
> They were present in `11.0.0-alpha.1.26062.101`
>
> Complete file list:
https://gist.github.com/rolfbjarne/7f42f3cf3ed3a815e2e9fe2b28c580fb#file-gistfile1-txt-L76-L82
>
> This started happening in this maestro PR:
dotnet/macios#24508
>
> specifically this commit:
dotnet/macios@ee15359
>
> I tried looking through the relevant dotnet/runtime commits, but I
didn't see anything obvious causing this.</issue_description>
>
> <agent_instructions>In the ResolveLibrariesRefAssembliesFromLocalBuild
target in eng/livebuilds.targets, add BuildNativeAOTRuntimePack !=
'true' to the condition in the ExcludeNativeLibrariesRuntimeFiles. It
should only apply to the item where TargetsAppleMobile == 'true'.
>
> Additionally, update the comment above the item to indicate that it
does not apply to nativeaot because we do not reach back into coreclr
sharedFramework artifacts.</agent_instructions>
>
> ## Comments on the Issue (you are @copilot in this section)
>
> <comments>
> <comment_new><author>@MichalStrehovsky</author><body>
> > and probably other packs for other RIDs as well, I haven't checked
>
> I checked
Microsoft.NETCore.App.Runtime.NativeAOT.linux-arm64.11.0.0-preview.1.26065.113
and that one has these.
Microsoft.NETCore.App.Runtime.NativeAOT.ios-arm64.11.0.0-preview.1.26065.113
doesn't have these.
>
> So looks to be iDevice specific. I can't build these things locally as
I don't have a mac.</body></comment_new>
> <comment_new><author>@steveisok</author><body>
> In the local build, it looks like coreclr and nativeaot are supposed
to look back to
`artifacts/bin/coreclr/ios.<arch>.<config>/sharedFramework` for the
native lib artifacts. NativeAOT does not appear to be doing that, hence
the reason the static libs aren't included. </body></comment_new>
> <comment_new><author>@steveisok</author><body>
> `ResolveLibrariesRuntimeFilesFromLocalBuild` typically copies all the
libraries and native lib bits. There's a step to exclude some native
bits if the runtime is coreclr or nativeaot because they are supposed to
be accounted for in `ResolveRuntimeFilesFromLocalBuild`. That's not
happening for nativeaot due to `BuildNativeAOTRuntimePack=true`.
</body></comment_new>
> <comment_new><author>@steveisok</author><body>
> @kotlarmilos if you want, I can fix it. It's no problem, so let me
know.</body></comment_new>
> </comments>
>
</details>
<!-- START COPILOT CODING AGENT SUFFIX -->
- Fixes #123253
<!-- START COPILOT CODING AGENT TIPS -->
---
💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: steveisok <[email protected]>1 parent 95f82dd commit 0bb8d77
1 file changed
+3
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
208 | | - | |
209 | | - | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
210 | 211 | | |
211 | 212 | | |
212 | 213 | | |
| |||
0 commit comments