runtime: Live apphost not being used by crossgen2 with source build

Description

.NET 7 in source-build does not currently use NativeAOT. Thus, when building Crossgen2 from source on platforms without apphost in nuget feeds, build of runtime fails with:

/var/build/dotnet7/testing/dotnet7-stage0/src/bootstrap/sdk/7.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(135,5): error NETSDK1084: There is no application host available for the specified RuntimeIdentifier 'linux-musl-x86'. [/var/build/dotnet7/testing/dotnet7-stage0/src/dotnet-e6dd91c290b808f971a1ac69c2fb29395bbf1051/src/runtime/src/coreclr/tools/aot/crossgen2/crossgen2.csproj]

Reproduction Steps

Crossbuild from x64 to x86, crossgen2 build will fail.

Expected behavior

Crossgen2 should be able to use to live apphost built previously by runtime

Actual behavior

Build fails due to no apphost for that RID

Regression?

Per https://github.com/dotnet/runtime/issues/7335 and https://github.com/dotnet/runtime/issues/66866, there was a time when this was a non-issue. With move to NativeAOT, UseLiveBuiltDotNetHost was dropped, and this use-case seems to have been removed.

Known Workarounds

None for now. I attempted to build runtime in two steps, to no avail:

ROOTFS_DIR="$CBUILDROOT" ./build.sh $args -subset Clr.Native+Host.Native
ROOTFS_DIR="$CBUILDROOT" ./build.sh $args /p:AppHostSourcePath="$builddir"/src/runtime/artifacts/obj/linux-musl-$_dotnet_target.Release/apphost/standalone/apphost

Configuration

.NET 7.0.100-rtm.22519.39 Alpine Linux Edge x64 to x86 crossbuild

Other information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (18 by maintainers)

Most upvoted comments

clr+libs+host+packs

Interesting, I didn’t know that x86 uses singlefilehost. Indeed, building with DotNetBuildFromSource=false yields a successful build on linux-musl-x86. This confirms this as being principally a source-build issue.