Skip to content

crossgen2 failure in VMR when using VMR stage 2 build scenario #95768

@mthalman

Description

@mthalman

Source build has a required scenario that involves building the VMR once to produce the .NET SDK. And then rebuilding the VMR again using the VMR that was just built. That scenario fails during the build of the runtime repo with the following error:

EXEC error message: An attempt was made to load a program with an incorrect format. [/repos/dotnet/src/runtime/artifacts/source-build/self/src/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj]

The full context of that MSBuild call is here:

Exec
    Assembly = Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
    Parameters
        Command = /repos/dotnet/src/runtime/artifacts/source-build/self/src/artifacts/bin/crossgen2_publish/x64/Release/fedora.38-x64/publish/crossgen2 /repos/dotnet/src/runtime/artifacts/source-build/self/src/artifacts/bin/coreclr/linux.x64.Release/IL/System.Private.CoreLib.dll --out /repos/dotnet/src/runtime/artifacts/source-build/self/src/artifacts/obj/Microsoft.NETCore.App.Crossgen2/Release/net9.0/fedora.38-x64/S.P.C.tmp
    CommandLineArguments = /repos/dotnet/src/runtime/artifacts/source-build/self/src/artifacts/bin/crossgen2_publish/x64/Release/fedora.38-x64/publish/crossgen2 /repos/dotnet/src/runtime/artifacts/source-build/self/src/artifacts/bin/coreclr/linux.x64.Release/IL/System.Private.CoreLib.dll --out /repos/dotnet/src/runtime/artifacts/source-build/self/src/artifacts/obj/Microsoft.NETCore.App.Crossgen2/Release/net9.0/fedora.38-x64/S.P.C.tmp
    Failed to load System.Private.CoreLib.dll (error code 0x8007000B)
    Path: /repos/dotnet/src/runtime/artifacts/source-build/self/src/artifacts/bin/crossgen2_publish/x64/Release/fedora.38-x64/publish/System.Private.CoreLib.dll
    Errors
        EXEC error message: An attempt was made to load a program with an incorrect format. [/repos/dotnet/src/runtime/artifacts/source-build/self/src/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj]
        /repos/dotnet/src/runtime/artifacts/source-build/self/src/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj(67,5): error MSB3073: The command "/repos/dotnet/src/runtime/artifacts/source-build/self/src/artifacts/bin/crossgen2_publish/x64/Release/fedora.38-x64/publish/crossgen2 /repos/dotnet/src/runtime/artifacts/source-build/self/src/artifacts/bin/coreclr/linux.x64.Release/IL/System.Private.CoreLib.dll --out /repos/dotnet/src/runtime/artifacts/source-build/self/src/artifacts/obj/Microsoft.NETCore.App.Crossgen2/Release/net9.0/fedora.38-x64/S.P.C.tmp" exited with code 137. [/repos/dotnet/src/runtime/artifacts/source-build/self/src/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj]
     (0x8007000B)
    Failed to create CoreCLR, HRESULT: 0x8007000B
    OutputProperties
        CrossgenExitCode = 137

Note that the output mentions this path, which does not exist on disk: /repos/dotnet/src/runtime/artifacts/source-build/self/src/artifacts/bin/crossgen2_publish/x64/Release/fedora.38-x64/publish/System.Private.CoreLib.dll

This seems to be related to the changes in #92677. /cc @jkoritzinsky

This does require the changes in dotnet/installer#17929 in order to reach this point of the VMR build.

Repro Steps

  1. Check out the main branch of the VMR
  2. Manually apply the changes from Add runtime patch to use net9.0 TFM installer#17929 if they don't already exist.
  3. git add .
  4. mkdir /repos/bootstrap
  5. ./prep.sh
  6. ./build.sh --clean-while-building --online
  7. cp artifacts/x64/Release/dotnet-sdk-*.tar.gz /repos/bootstrap
  8. cp artifacts/x64/Release/Private.SourceBuilt.*.tar.gz /repos/bootstrap
  9. git clean -fdx
  10. git checkout -- .
  11. mkdir .dotnet
  12. tar -xzf /repos/bootstrap/dotnet-sdk-*.tar.gz -C .dotnet
  13. ./prep.sh --no-artifacts --no-bootstrap --no-sdk
  14. tar -xzf prereqs/packages/archive/Private.SourceBuilt.Prebuilts.*.tar.gz -C prereqs/packages/archive
  15. tar -xzf /repos/bootstrap/Private.SourceBuilt.Artifacts.*.tar.gz -C prereqs/packages/archive
  16. ./build.sh --with-packages prereqs/packages/archive --with-sdk .dotnet --online

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions