Skip to content
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

Copy published crossgen2 in artifacts/tests #80154

Draft
wants to merge 28 commits into
base: main
Choose a base branch
from

Conversation

am11
Copy link
Member

@am11 am11 commented Jan 3, 2023

Fixes #80110

@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Jan 3, 2023
@ghost
Copy link

ghost commented Jan 3, 2023

Tagging subscribers to this area: @hoyosjs
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #80110

Author: am11
Assignees: -
Labels:

area-Infrastructure-coreclr

Milestone: -

@am11 am11 force-pushed the feature/tests/published-crossgen2 branch 2 times, most recently from 50a8fa9 to 5cb264a Compare January 4, 2023 03:31
@am11 am11 marked this pull request as ready for review January 4, 2023 03:31
@am11 am11 force-pushed the feature/tests/published-crossgen2 branch from 300ce0d to 25514ef Compare January 4, 2023 08:17
@runfoapp runfoapp bot mentioned this pull request Jan 4, 2023
@am11 am11 force-pushed the feature/tests/published-crossgen2 branch 7 times, most recently from 583f275 to 72fe8e5 Compare January 4, 2023 20:57
@am11 am11 force-pushed the feature/tests/published-crossgen2 branch 2 times, most recently from 931c0ee to db8b174 Compare January 6, 2023 14:12
@am11 am11 force-pushed the feature/tests/published-crossgen2 branch 3 times, most recently from a7d30ec to 79c6554 Compare January 7, 2023 22:56
@trylek
Copy link
Member

trylek commented Feb 5, 2023

Overall looks good to me, thanks Adeel, in general I believe this to be heading in the right direction. We probably need to soften some rough edges though. It seems to me that quite a few R2R tests failed in your PR run, that will require investigation and fixing (theoretically these could be caused by the weird addition of ".." in populating CORE_ROOT I commented on in the review as I find that surprising). Please also see my comment regarding the filtering on checked build configuration. Once we're on the same page w.r.t. these aspects, I'll be more than happy to approve your change and merge it in.

@am11 am11 closed this Feb 5, 2023
@am11 am11 reopened this Feb 5, 2023
@trylek
Copy link
Member

trylek commented Feb 7, 2023

In our today .NET core runtime sync several people emphasized that we should coordinate this work with the diagnostics team to make sure we don't paint ourselves in a corner due to the fact that today NativeAOT bugs are in general harder to analyze and investigate. /cc-ing @tommcdon for visibility.

@@ -42,7 +42,7 @@
<MSBuild Condition="'$(Crossgen2Supported)' == 'true'"
Targets="Restore;PublishToDisk"
BuildInParallel="true"
Properties="NativeAotSupported=$(NativeAotSupported);OutputPath=$(CORE_ROOT)\crossgen2"
Properties="NativeAotSupported=$(NativeAotSupported);OutputPath=$(CORE_ROOT)\crossgen2;MSBuildRestoreSessionId=$([System.Guid]::NewGuid());"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you split this into two <MSBuild> invocations, one with Restore and the session ID and one with PublishToDisk and no session ID?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming MSBuildRestoreSessionId applies only to restore, will split make any difference?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, as it will force a re-evaluation of the MSBuild project for the PublishToDisk target as the global properties differ from the Restore target invocation.

@am11
Copy link
Member Author

am11 commented Apr 17, 2024

@jkoritzinsky, here is the error from linux_musl-arm64 Debug AllSubsets_CoreCLR_ReleaseRuntimeLibs logs:

ILCompiler.DependencyAnalysisFramework -> /__w/1/s/artifacts/bin/ILCompiler.DependencyAnalysisFramework/arm64/Debug/ILCompiler.DependencyAnalysisFramework.dll
ILCompiler.ReadyToRun -> /__w/1/s/artifacts/bin/ILCompiler.ReadyToRun/arm64/Debug/ILCompiler.ReadyToRun.dll
/__w/1/s/.dotnet/sdk/9.0.100-preview.3.24204.13/Microsoft.Common.CurrentVersion.targets(5270,5): error MSB3030: Could not copy the file "/__w/1/s/artifacts/obj/coreclr/crossgen2_publish/linux.arm64.Debug/apphost" because it was not found. [/__w/1/s/src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj]
##[error].dotnet/sdk/9.0.100-preview.3.24204.13/Microsoft.Common.CurrentVersion.targets(5270,5): error MSB3030: (NETCORE_ENGINEERING_TELEMETRY=Build) Could not copy the file "/__w/1/s/artifacts/obj/coreclr/crossgen2_publish/linux.arm64.Debug/apphost" because it was not found.

It's affecting all archs.

@@ -29,6 +27,7 @@
<!-- Disable crossgen on FreeBSD when cross building from Linux. -->
<PublishReadyToRun Condition="'$(TargetOS)' == 'freebsd' and '$(CrossBuild)' == 'true'">false</PublishReadyToRun>
<PublishReadyToRunComposite>$(PublishReadyToRun)</PublishReadyToRunComposite>
<UseLocalAppHostPack>true</UseLocalAppHostPack>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this line back up to the unconditional property group? I think this is what's causing the failures (as the local apphost pack can't be found).

Copy link
Member Author

@am11 am11 Apr 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After reverting, next place where it looks for apphost is:

.dotnet/sdk/9.0.100-preview.3.24204.13/Microsoft.Common.CurrentVersion.targets(5270,5): error MSB3030: Could not copy the file "/__w/1/s/artifacts/obj/coreclr/crossgen2_publish/linux.x64.Checked/apphost" because it was not found.

(from Build coreclr Pri0 Runtime Tests Run linux x64 checked failed)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is crossgen2_publish NativeAOT'd here?

We just updated the repo to Preview 3 SDK that has this fix: dotnet/sdk#38644 - SDK should not even be looking for an apphost when doing NAOT publish.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried a few things but this looks like a deadlock.

  • crossgen2_publish project is manully publishing AOT app using live build, meaning PublishAot=true is not set
  • explicitly setting UseAppHost=false with SelfContained=false for NativeAotSupported != '' failed with error NETSDK1102: Optimizing assemblies for size is not supported for the selected publish configuration. Please ensure that you are publishing a self-contained app
  • explicitly setting SelfContained=false with with SelfContained=true failed with error NETSDK1067: Self-contained applications are required to use the application host. Either set SelfContained to false or set UseAppHost to true.
  • also PublishTrimmed is requiring apphost

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried a few things but this looks like a deadlock.

These problems look a lot like the kind of problems one gets when running the Publish target, but not setting the _IsPublishing property.

  • We shouldn't need to set SelfContained=true. The SDK will do it when _IsPublishing is set to true and PublishAot or PublishTrimmed or PublishSingleFile is true.
  • We shouldn't need to change UseAppHost. The SDK will default it to the correct value based on _IsPublishing and PublishTrimmed/PublishAot/etc.

Running the Publish target without dotnet publish has a bunch of bad UX tracked in dotnet/sdk#26324.

Copy link
Member Author

@am11 am11 Apr 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this manual setup is likely there so crossgen2 is published with live build of ILCompiler when NativeAotSupported==true. ILCompiler itself is published using nuget package / sdk integration. crossgen2_publish.csproj line 4 is setting _IsPublishing. Invoking Publish / PublishToDisk directory gives the same missing apphost error. -v:diag dump suggests one of the linker/trimmer target is trying to copy apphost where it fails.

@am11
Copy link
Member Author

am11 commented Apr 18, 2024

Add alpine to target triplet for crossbuild

We will need to wait for next preview with #101213. Locally, I've verified that it fixed the alpine-arm crossbuild by copying the live version to nuget:

cp /runtime/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets \
   /root/.nuget/packages/microsoft.dotnet.ilcompiler/9.0.0-preview.4.24215.1/build

@agocke agocke marked this pull request as draft June 17, 2024 20:07
@am11 am11 reopened this Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Infrastructure-coreclr community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong crossgen2 binary in artifacts/tests
7 participants