-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 broken for Apple TFMs in .NET 10 #46790
Comments
…tually publishing." This reverts commit b1c05cc. It's a dotnet/sdk issue: dotnet/sdk#46790
From what I can tell, it's set always because we want to avoid downloading the target ILCompiler pack during build. How does ios avoid the situation where we run ILC over the coreclr runtime pack? I think by setting NativeCompilationDuringPublish=false, it avoids that issue. So maybe we should fix this by adding a condition on NativeCompilationDuringPublish. |
First of all, my apologies for not trying out Sven's change with NativeAOT iOS builds. Which got me wondering, how did we catch this so late - the SDK change was a month ago? Based on our discussions around NativeAOT runtime packs and running build vs publish targets, could we fix this by adding a condition |
I had the same thought, but found this comment: xamarin/xamarin-macios@b4975e2#diff-2e24f1b6f44df7580244d00f106fa1a9e2257536fbca9d7bbdc74571549324a9R479-R480. I interpreted this to mean that we want to set it to true even when not publishing, to avoid downloading the target ILCompiler pack during build. Maybe @filipnavara can comment on it. |
Oh, wow, that's an old workaround, so my memory is a bit fuzzy on that one. The problem was that specifying just Perhaps the workaround is not needed anymore (ie. SDK would not try to download non-existent ILCompiler when |
Thanks for the context! I believe SDK will still try to download the non-existing target ILC pack unless Why does ios invoke the publish targets during build? Could they be changed to avoid depending on the SDK's built-in publish targets? That would avoid this issue entirely - building for ios is running publish targets in a non-standard way that breaks here. If that's not feasible, I can see two other options:
|
Copying @rolfbjarne's answer from another conversation:
I believe these SDK targets were never designed to be used this way (when not actually publishing). There's a good chance we'll run into similar issues if the SDK adds more consistency checks to related targets. But it looks like fixing this would be a larger change, so I suggest we take #46839 for now. @ivanpovazan would you be able to help validate the fix? |
Can someone elaborate on this? The design of the SDK is that anything that needs to be used should be downloaded during initial restore. In the future I expect a lot of CI builds will enforce this -- network access will be cut off after doing a restore. Shouldn't we always download all the runtime packs we might need later? Even if they're not used immediately? |
This is about the target ILCompiler pack specifically, not the nativeaot runtime pack. That one should never be downloaded when targeting ios. (I think the nativeaot runtime pack should get downloaded during dotnet build as usual.) |
I've been on vacation for most of that time, so nobody was around to see it.
No, that makes
Regarding this part:
This comes from here: https://github.com/xamarin/xamarin-macios/blob/676fe9f33bb288a80e960a251345e05b5e78bcee/dotnet/targets/Xamarin.Shared.Sdk.targets#L251-L271 This is from the beginning of implementing iOS support in .NET 5, so it's been there for quite a while. IIRC the problem here is that we need "dotnet build" to build something self-contained, which afaik "dotnet build" isn't designed to do - but "dotnet publish" is. So when I implemented .NET support for Apple platforms in .NET 5, I ended up picking parts of "dotnet publish" (such as FWIW for us there's no real difference in the build logic between "dotnet build" and "dotnet publish" (until NativeAOT came along at least) - "dotnet publish" is literally just "dotnet build" + zipping up the results to create an .ipa. |
…tnet/sdk issue. Ref: dotnet/sdk#46790
…tnet/sdk issue. Ref: dotnet/sdk#46790
On a slightly different but related note, and regarding:
This means that the current state of #37872 wouldn't really help as it sets a default for |
The point of that PR was primarily to get other platforms on the same plan, ie. separate ILCompiler pack on host and target runtime pack. The endgame plan was to remove the runtime bits from the ILCompiler packs because now we ship them at two places. There was some earlier conversation on whether |
Looks that way, yes. |
…tnet/sdk issue. (#22186) Ref: dotnet/sdk#46790
NativeAOT is broken for Apple TFMs after #46070.
Now the following fails:
with:
and this fails:
with:
In the past we've automatically set
PublishAotUsingRuntimePack=true
(always, not only for publish), which I believe we're still supposed to do.CC @sbomer @MichalStrehovsky
Note: this effectively breaks NativeAOT support in .NET 10 Preview 1 for us.
The text was updated successfully, but these errors were encountered: