Skip to content

Fix linux-bionic CI build breaks - #8009

Merged
akoeplinger merged 2 commits into
mainfrom
fix-linux-bionic-crossgen2
Jul 28, 2026
Merged

akoeplinger merged 2 commits into
mainfrom
fix-linux-bionic-crossgen2

Conversation

@akoeplinger

Copy link
Copy Markdown
Member

The LinuxBionic_Shortstack_x64 and LinuxBionic_Shortstack_arm64 legs have been failing since source update #7872 flowed in dotnet/runtime#131115 ("Enable CoreCLR for linux-bionic platforms").

Regression window: build 1524524 (green) → 1526335 (red).

Root cause

dotnet/runtime#131115 enabled CoreCLR for linux-bionic by copying the Android configuration. But linux-bionic reports TargetOS as linux (not linux-bionic) and TargetsMobile as false, so every Android-shaped guard silently let it through. The repo convention is to spell bionic out alongside mobile — $(TargetsMobile) != true and $(TargetsLinuxBionic) != true, as at Subsets.props lines 32, 49, 54, 733, 740 and 748 — and that pairing was only partly applied.

x64: jitinterface_x64 fails to load

_BuildAnyCrossArch never fired for bionic: CrossBuild is false, BuildArchitecture equals TargetArchitecture, and HostOS equals TargetOS (both linux). Android escapes this only because its TargetOS really is android.

With no cross-components build, CrossHostArch stayed empty and AotCompilerCommon.props copied the NDK-built libjitinterface_x64.so into the crossgen2 output. The glibc-host crossgen2 then failed to dlopen it — note liblog.so, an Android-only library:

System.DllNotFoundException: Unable to load shared library jitinterface_x64 or one of its dependencies.
  liblog.so: cannot open shared object file: No such file or directory

linux-bionic is always cross-targeted via the NDK regardless of what HostOS/TargetOS report, so the check is keyed on TargetsLinuxBionic. The same expression is duplicated in crossgen2.csproj and ILCompiler.ReadyToRun.Tests.csproj, so those are updated too.

The fix is safe because the cross-components build passes -hostos $(HostOS) = linux, and build-commons.sh gates the NDK toolchain on that argument — so it correctly skips the NDK and produces glibc host binaries.

arm64: ilasm/ildasm packaging

The NDK toolchain sets CMAKE_SYSTEM_NAME=Android, so CMake sees CLR_CMAKE_TARGET_ANDROID and skips CLR_CMAKE_BUILD_TOOLS. ilasm/ildasm are therefore never produced, but coreclr-packages.proj gated them only on TargetsMobile:

File not found: .../linux.arm64.Release/ilasm

_SdkToolsSupportedOS already treats bionic like mobile for exactly this reason, so this mirrors it. (x64 would have hit this too once the crossgen2 fix landed.)

_BuildCdacPack hardening

_BuildCdacPack passes all four terms for bionic while compile-native.proj disables SupportsNativeAotComponents for it — the same "pack requested, artifact never built" shape as the ilasm bug. Latent today only because bionics default subsets omit tools; Android is blocked by two independent terms, bionic by none. Verified with /p:Subset=clr+tools+packs: bionic _BuildCdacPack=true, Android empty.

Other commits

Enable CoreCLR for linux-bionic arm. The bionic line picked up an arm exclusion that Android had already dropped two months earlier (re-enabled 2026-05-21; blocking issue dotnet/runtime#111665 closed 2026-07-20). That issue was "fseeko/ftello not supported on arm32 and x86 below API level 24", and build-commons.sh pins ANDROID_API_LEVEL to 24, so it never applied here. This is the one commit that changes a currently-green leg — LinuxBionic_Shortstack_arm will build full CoreCLR arm32 for the first time. It is isolated to one line and can be dropped independently if that leg goes red.

Remove dead HostOS check. RuntimeIdentifier.props overrode PortableOS when HostOS is win, but OSArch.props has only ever set HostOS to windows — including at the commit that introduced the check in February 2025 — so it never fired. Removed rather than corrected, since making it fire would change TargetRid from linux-x64 to win-x64 for Windows-host cross-target builds. No behavior change.

Validation

Verified by MSBuild property/item evaluation, since a real linux-bionic build needs a Linux host plus the Android NDK:

config _BuildAnyCrossArch before → after TargetRid
bionic-x64 "" → true linux-bionic-x64
bionic-arm64 true → true linux-bionic-arm64
bionic-arm true → true linux-bionic-arm
linux-x64 "" → "" linux-x64
android-arm64 unchanged android-arm64

ILAsm/ILDAsm and cdac now drop out for bionic only; Android and plain Linux are unaffected. CI is the real test.

These changes belong in dotnet/runtime and are made here to unblock CI; they should be backflowed.

This PR was prepared with GitHub Copilot CLI.

Enabling CoreCLR for linux-bionic (dotnet/runtime#131115) copied the
Android configuration, but linux-bionic reports TargetOS as 'linux' and
TargetsMobile as false, so the Android-shaped guards silently let it
through.

_BuildAnyCrossArch never fired for bionic: CrossBuild is false,
BuildArchitecture equals TargetArchitecture, and HostOS equals TargetOS
(both 'linux'). No cross-components build ran, leaving CrossHostArch
empty, so AotCompilerCommon.props copied the NDK-built
libjitinterface_x64.so into the crossgen2 output. The glibc host
crossgen2 then failed to dlopen it:

  System.DllNotFoundException: Unable to load shared library
  'jitinterface_x64' [...] liblog.so: cannot open shared object file

linux-bionic is always cross-targeted via the NDK regardless of what
HostOS/TargetOS report, so key the check on TargetsLinuxBionic. The same
expression is duplicated in crossgen2.csproj and
ILCompiler.ReadyToRun.Tests.csproj, so update those too.

Separately, the NDK toolchain sets CMAKE_SYSTEM_NAME=Android, so CMake
sees CLR_CMAKE_TARGET_ANDROID and skips CLR_CMAKE_BUILD_TOOLS. ilasm and
ildasm are therefore never produced, but coreclr-packages.proj gated them
only on TargetsMobile, which is false for bionic, breaking the arm64 leg:

  File not found: '.../linux.arm64.Release/ilasm'

Also harden _BuildCdacPack, which passes every term for bionic while
compile-native.proj disables SupportsNativeAotComponents for it. That is
latent today only because bionic's default subsets omit 'tools'.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d6553736-6f22-41f2-9bd4-7223785d09e6
Copilot AI review requested due to automatic review settings July 28, 2026 12:24
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@akoeplinger

Copy link
Copy Markdown
Member Author

/azp run dotnet-unified-build-full

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes CI failures in the VMR’s flowed src/runtime build logic for linux-bionic Shortstack legs by ensuring bionic is treated like a cross-targeted/NDK-driven platform where appropriate (rather than accidentally matching “plain linux” guards based on TargetOS=linux).

Changes:

  • Treat TargetsLinuxBionic=true as a trigger for “cross-arch host tools/components required” in crossgen2 and R2R test JIT-build logic.
  • Exclude linux-bionic from ILAsm/ILDAsm and CDAC pack/build paths where artifacts are not produced under the NDK toolchain assumptions.
  • Enable CoreCLR for linux-bionic arm by removing the prior arm exclusion (keeping the existing x86 exclusion).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/ILCompiler.ReadyToRun.Tests.csproj Forces cross-JIT build path for linux-bionic so host-loadable binaries are produced for R2R tests.
src/runtime/src/coreclr/tools/aot/crossgen2/crossgen2.csproj Ensures bionic sets CrossHostArch so cross-components/host tool behavior matches bionic’s actual cross-targeting needs.
src/runtime/src/coreclr/.nuget/coreclr-packages.proj Avoids packaging ILAsm/ILDAsm for linux-bionic where the toolchain path doesn’t produce them.
src/runtime/eng/Subsets.props Updates bionic support matrix and subset gating: cross-arch tool build trigger, cdac pack exclusion, and enables CoreCLR for bionic arm.
src/runtime/eng/RuntimeIdentifier.props Removes dead HostOS == 'win' PortableOS override (HostOS is windows).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@akoeplinger

Copy link
Copy Markdown
Member Author

/azp run dotnet-unified-build-full

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@akoeplinger

Copy link
Copy Markdown
Member Author

/azp run dotnet-unified-build-full

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@akoeplinger

Copy link
Copy Markdown
Member Author

/azp run dotnet-unified-build-full

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

The PortableOS override was conditioned on HostOS being 'win', but
eng/OSArch.props has only ever set HostOS to 'windows' on Windows,
including at the commit that introduced this check in February 2025.
HostOS is not overridden anywhere else; the pipelines pass AotHostOS,
which is a different property. The condition has therefore never
evaluated to true.

Remove it rather than correcting the value, since making it fire would
change TargetRid from linux-x64 to win-x64 for Windows-host builds that
target another OS, long after everything downstream settled on it being
inert.

No behavior change: PortableOS and TargetRid are unchanged for
windows-x64, linux-x64, linux-bionic-x64, android-arm64, and a
Windows-host/linux-target build. Windows still resolves to 'win' through
the separate 'windows' to 'win' normalization above.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d6553736-6f22-41f2-9bd4-7223785d09e6
@akoeplinger
akoeplinger force-pushed the fix-linux-bionic-crossgen2 branch from dbf4218 to 9ce6292 Compare July 28, 2026 16:39
@akoeplinger

Copy link
Copy Markdown
Member Author

Latest run (1529675) confirms the core fix: LinuxBionic_Shortstack_x64 and LinuxBionic_Shortstack_arm64 both pass, which are the two legs that regressed.

The bionic arm work turned out to be a bigger change than expected, so I have dropped it from this PR to unblock getting CI green. This PR is now just the two original fixes:

  • Fix linux-bionic crossgen2 and ILAsm build breaks
  • Remove dead HostOS check from RuntimeIdentifier.props

The three arm commits are preserved on the bionic-arm-coreclr branch and will get their own PR.

For the record, the arm leg now fails later, in the bundle rather than in restore:

error NETSDK1004: Assets file '/__w/1/s/src/runtime/artifacts/obj/mono-pack/project.assets.json' not found.
src/runtime/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj(44,5): error MSB4181

So the bundle wants the Mono runtime pack, which does not exist for bionic arm because _MonoSupportedArch excludes that architecture. Enabling CoreCLR for bionic arm needs the bundle/pack composition to handle a bionic target that has CoreCLR but no Mono — that is the piece to work through in the follow-up.

@akoeplinger

Copy link
Copy Markdown
Member Author

/azp run dotnet-unified-build-full

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@akoeplinger

Copy link
Copy Markdown
Member Author

relevant jobs on dotnet-unified-build-full are green, rest are unrelated infrastructure issues, merging

@akoeplinger
akoeplinger merged commit 43cdb1f into main Jul 28, 2026
60 of 64 checks passed
@akoeplinger
akoeplinger deleted the fix-linux-bionic-crossgen2 branch July 28, 2026 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants