Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions .github/actions/setup-llvm22/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
18 changes: 18 additions & 0 deletions changelog.d/7388-setup-llvm22-clang.md
Original file line number Diff line number Diff line change
@@ -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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Qualify the #7384 claim.

The PR scope leaves gc-native-roots.yml discovery changes for follow-up issue #7384. Line 18 says the root cause is fixed for all 18 workflows. This overstates the documented scope. Reword the line to describe the setup-llvm22 fix without claiming that the follow-up discovery work is complete.

Based on the PR objectives, gc-native-roots.yml discovery remains follow-up work.

Proposed changelog wording
-Fixes the root cause of `#7384` for all 18 workflows rather than one.
+Ensures all 18 workflows receive a co-located LLVM 22 `clang` and prevents
+fallback to Ubuntu 24.04's unversioned LLVM 18 toolchain. Discovery changes
+for `#7384` remain follow-up work.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Fixes the root cause of #7384 for all 18 workflows rather than one.
Ensures all 18 workflows receive a co-located LLVM 22 `clang` and prevents
fallback to Ubuntu 24.04's unversioned LLVM 18 toolchain. Discovery changes
for `#7384` remain follow-up work.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@changelog.d/7388-setup-llvm22-clang.md` at line 18, Revise the changelog
entry’s “Fixes the root cause of `#7384` for all 18 workflows” statement to
describe only the setup-llvm22 fix. Remove the claim that all 18 workflows or
the follow-up gc-native-roots.yml discovery work are complete, while preserving
the reference to `#7384` if appropriate.

Loading