From 66247296c45bfe70206dc2b2706b3f0b6d79eb30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ralph=20K=C3=BCpper?= Date: Tue, 4 Aug 2026 18:37:41 +0200 Subject: [PATCH 1/2] ci: install clang-22 in setup-llvm22 and assert the pair apt ships opt and clang as separate packages, so llvm-22-dev alone leaves /usr/lib/llvm-22/bin/opt with no clang beside it -- the state ubuntu-24.04-arm runners land in. Consumers needing a matched opt+clang pair (the RS4GC arm in gc-native-roots.yml) then fail the pair-check, or fall back to hand-rolled discovery and install the distro's unversioned llvm clang, which on Ubuntu 24.04 is LLVM 18 -- running opt 18 over IR emitted by Perry's linked LLVM 22. Install clang-22, symlink it under the llvm-config-22 prefix so directory-based resolution finds a co-located pair, and assert clang's major alongside the existing llvm-config check. A green setup step that leaves a mismatched clang is the failure this action exists to prevent. Fixes the root cause of #7384 for all 18 workflows rather than one. --- .github/actions/setup-llvm22/action.yml | 24 +++++++++++++++++-- changelog.d/PLACEHOLDER-setup-llvm22-clang.md | 18 ++++++++++++++ 2 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 changelog.d/PLACEHOLDER-setup-llvm22-clang.md diff --git a/.github/actions/setup-llvm22/action.yml b/.github/actions/setup-llvm22/action.yml index 75672bcbc3..80f9508df8 100644 --- a/.github/actions/setup-llvm22/action.yml +++ b/.github/actions/setup-llvm22/action.yml @@ -50,11 +50,31 @@ runs: echo "deb http://apt.llvm.org/${VERSION_CODENAME}/ llvm-toolchain-${VERSION_CODENAME}-22 main" \ | sudo tee /etc/apt/sources.list.d/llvm22.list >/dev/null sudo apt-get update -qq + # `clang-22` is NOT implied by `llvm-22-dev`: apt ships opt and clang as + # separate packages, so installing only the dev libraries leaves + # /usr/lib/llvm-22/bin/opt with no clang beside it. That is exactly what + # ubuntu-24.04-arm hits. Anything needing a MATCHED opt+clang pair — the + # RS4GC arm in gc-native-roots.yml — then finds a half-populated bin dir + # and either fails outright or falls back to hand-rolled discovery and + # picks up the distro's LLVM 18. Install the pair here, once, so every + # workflow gets a version-matched toolchain from one place. sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -qq \ - llvm-22-dev libpolly-22-dev libzstd-dev + llvm-22-dev libpolly-22-dev libzstd-dev clang-22 llvm-config-22 --version | grep -q '^22\.' \ || { echo "::error::apt LLVM is not 22.x"; exit 1; } - echo "LLVM_SYS_221_PREFIX=$(llvm-config-22 --prefix)" >> "$GITHUB_ENV" + PREFIX="$(llvm-config-22 --prefix)" + # Co-locate clang with opt. apt installs the versioned binary at + # /usr/bin/clang-22, but consumers resolve a toolchain by DIRECTORY — + # PERRY_LLVM_OPT and PERRY_LLVM_CLANG must come from the same bin dir or + # opt and clang can skew across majors — so it has to sit under $PREFIX. + if [ ! -x "$PREFIX/bin/clang" ] && [ -x /usr/bin/clang-22 ]; then + sudo ln -sf /usr/bin/clang-22 "$PREFIX/bin/clang" + fi + # Assert the pair, not just llvm-config. A green setup step that leaves + # a mismatched clang is the failure this whole action exists to prevent. + "$PREFIX/bin/clang" --version | grep -q 'version 22\.' \ + || { echo "::error::clang under $PREFIX is not 22.x"; exit 1; } + echo "LLVM_SYS_221_PREFIX=$PREFIX" >> "$GITHUB_ENV" - name: LLVM 22 (Windows, official MSVC tarball) if: runner.os == 'Windows' diff --git a/changelog.d/PLACEHOLDER-setup-llvm22-clang.md b/changelog.d/PLACEHOLDER-setup-llvm22-clang.md new file mode 100644 index 0000000000..e94b6e4080 --- /dev/null +++ b/changelog.d/PLACEHOLDER-setup-llvm22-clang.md @@ -0,0 +1,18 @@ +**Fixed** `setup-llvm22` installed LLVM 22's development libraries without +`clang-22`, leaving `/usr/lib/llvm-22/bin/opt` with no clang beside it. + +apt ships opt and clang as separate packages, so `llvm-22-dev` alone produces a +half-populated bin directory — the state `ubuntu-24.04-arm` runners land in. +Consumers that need a *matched* opt+clang pair (the RS4GC arm in +`gc-native-roots.yml`) then either fail the pair-check outright or fall back to +hand-rolled discovery and install the distro's unversioned `llvm clang`, which on +Ubuntu 24.04 is LLVM 18 — running `opt` 18 over IR emitted by Perry's linked +LLVM 22. + +The action now installs `clang-22`, symlinks it under the `llvm-config-22` +prefix so directory-based toolchain resolution finds a co-located pair, and +asserts clang's major version alongside the existing `llvm-config` check. A green +setup step that leaves a mismatched clang is precisely the failure this action +exists to prevent. + +Fixes the root cause of #7384 for all 18 workflows rather than one. From 66788cd811bdd4465f538c9a7705db03ddf2f548 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ralph=20K=C3=BCpper?= Date: Tue, 4 Aug 2026 18:37:59 +0200 Subject: [PATCH 2/2] docs: name the fragment for its real PR (#7388) --- ...ACEHOLDER-setup-llvm22-clang.md => 7388-setup-llvm22-clang.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename changelog.d/{PLACEHOLDER-setup-llvm22-clang.md => 7388-setup-llvm22-clang.md} (100%) diff --git a/changelog.d/PLACEHOLDER-setup-llvm22-clang.md b/changelog.d/7388-setup-llvm22-clang.md similarity index 100% rename from changelog.d/PLACEHOLDER-setup-llvm22-clang.md rename to changelog.d/7388-setup-llvm22-clang.md