Repository navigation
fix: make tarball-installed LLVM usable from fresh shells (bootstrap → make build LTO=1) - #10373
Conversation
…LTO=1) The package-manager paths of install_llvm.sh land versioned binaries in /usr/bin, so 'make bootstrap' then 'make build LTO=1' from a later shell finds clang-<ver> fine. The tarball fallback (Azure Linux, Mariner, and any distro without matching packages) unpacks to /usr/local/llvm and wires PATH only for GitHub Actions ($GITHUB_PATH) and the shell that ran the script — in a fresh shell build.sh cannot find clang-<ver> and LTO refuses to enable, and bindgen has no libclang. Symlink the tools build.sh looks up (clang-<ver>, clang++-<ver>, lld-<ver>, ld.lld) and llvm-config — through which bindgen's clang-sys locates libclang without a persisted LIBCLANG_PATH — into /usr/local/bin, mirroring what the package paths give and the gcc-toolset shims rocky_linux_8.sh already creates. Verified in a clean azurelinux 3.0 container: after install_llvm.sh, a fresh 'env -i PATH=<default>' shell resolves clang-21/clang++-21/lld-21/ ld.lld from /usr/local/bin and 'llvm-config --libdir' yields /usr/local/llvm/lib containing libclang.so. Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d637a34f79
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| target="${bindir}/${tool}" | ||
| [[ -e "$target" ]] || target="${bindir}/${tool%-${LLVM_VER}}" | ||
| [[ -e "$target" ]] || continue | ||
| $MODE ln -sf "$target" "/usr/local/bin/${tool}" || true |
There was a problem hiding this comment.
Fail when fresh-shell symlinks cannot be installed
When /usr/local/bin is missing or unwritable (for example a non-root/manual install using a writable LLVM_INSTALL_DIR), this suppresses the ln failure, so the script exits successfully and the final verification still passes because export_path_gha already modified the current shell's PATH. A later clean shell will still not find clang-21/lld-21, which is the failure this change is meant to fix; create the destination and propagate/report the error instead of ignoring it.
Useful? React with 👍 / 👎.
| link_tools_for_fresh_shells() { | ||
| local bindir="${INSTALL_DIR}/bin" | ||
| local tool target | ||
| for tool in "clang-${LLVM_VER}" "clang++-${LLVM_VER}" "lld-${LLVM_VER}" ld.lld llvm-config; do |
There was a problem hiding this comment.
Avoid exposing lld-21 as a fuse-ld value
In the tarball/fresh-shell path, adding lld-${LLVM_VER} makes build.sh choose LINKER="lld-$RUSTC_LLVM_VERSION" and pass -fuse-ld=$LINKER in the LTO CMake/Rust flags. Clang's -fuse-ld= accepts lld (which invokes ld.lld) but rejects versioned names such as lld-21 as an invalid linker name, so make build LTO=1 can get past compiler discovery and then fail at the first link. Keep lld/ld.lld discoverable without causing build.sh to select lld-21, or update the LTO path to pass a valid linker selector.
Useful? React with 👍 / 👎.
Extends the fresh-shell LLVM fix so a default (LTO=1) bundled build works
on every OS, each reproduced and verified in a clean container:
- install_llvm.sh: symlink ld.lld-${LLVM_VER} too — build.sh links with
-fuse-ld=lld-${LLVM_VER}, which clang resolves to an executable named
ld.lld-${LLVM_VER}; the tarball ships only unversioned ld.lld (broke
amazonlinux2023, azurelinux3). Also install llvm-${LLVM_VER} on the apt
native path — CMake's IPO archive rules need llvm-ar/llvm-ranlib, which
--no-install-recommends skips (broke ubuntu 26.04).
- rocky_linux_8.sh: install lld — EL8's llvm-toolset ships clang-21 but
lld is a separate RPM, so -fuse-ld=lld failed with 'invalid linker name'.
- alpine_linux_3.sh: emit a GROUP() linker script for libLLVM-<ver>.a
instead of a GNU thin archive (ar rcT), which ld.lld cannot parse; add
compiler-rt for the clang-built test-dep sdists.
- microsoft_azure_linux_3.0.sh: retry tdnf with a repogpgcheck-plugin
fallback — Azure Linux mirrors intermittently 404 the metadata sig.
- build.sh: add -Wno-unknown-warning-option in the LTO (clang) branch so
GCC-only -W options in the environment don't become fatal under vendored
-Werror; inherit LTO=1 when reusing a build dir whose CMake cache has
IPO enabled, so a non-LTO 'make test' re-drive doesn't reject the LTO
bitcode static libs.
Co-Authored-By: Claude Fable 5 <[email protected]>
|
Pushed Note: the alpine |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #10373 +/- ##
==========================================
+ Coverage 81.16% 81.51% +0.35%
==========================================
Files 552 558 +6
Lines 74367 75289 +922
Branches 29707 30271 +564
==========================================
+ Hits 60359 61375 +1016
+ Misses 13730 13631 -99
- Partials 278 283 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 12b1af7c98
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| local i | ||
| for i in 1 2 3; do | ||
| $MODE tdnf install -y "$@" && return 0 | ||
| $MODE tdnf --disableplugin=tdnfrepogpgcheck install -y "$@" && return 0 |
There was a problem hiding this comment.
Use a tdnf-supported plugin switch
On Azure Linux when the first install hits the tdnfrepogpgcheck/TDNFVerifySignature 2004 failure this fallback is meant to handle, this command still fails before installing anything because --disableplugin=... is a DNF option, not one of tdnf's supported command options (the upstream tdnf options list --nogpgcheck, --disablerepo, etc., but not --disableplugin). The Azure setup workflow in this repo already uses tdnf install -y --noplugins ..., so use a tdnf-supported way to skip that repo-metadata plugin; otherwise the new retry loop does not actually recover from the documented failure mode.
Useful? React with 👍 / 👎.
| if [ ! -e /usr/lib/llvm${LLVM_VER}/lib/libLLVM-${LLVM_VER}.a ]; then | ||
| # shellcheck disable=SC2046 | ||
| $MODE ar rcT /usr/lib/llvm${LLVM_VER}/lib/libLLVM-${LLVM_VER}.a \ | ||
| /usr/lib/llvm${LLVM_VER}/lib/libLLVM*.a \ | ||
| /usr/lib/libzstd.a | ||
| # Expand the glob before tee creates the output file, so the combined | ||
| # archive never lists itself. | ||
| # shellcheck disable=SC2086 | ||
| LLVM_COMPONENT_LIBS=$(echo /usr/lib/llvm${LLVM_VER}/lib/libLLVM*.a /usr/lib/libzstd.a) |
There was a problem hiding this comment.
Replace stale Alpine thin archives
On Alpine hosts that have already run the previous bootstrap, /usr/lib/llvm${LLVM_VER}/lib/libLLVM-${LLVM_VER}.a already exists as the old thin archive this change says ld.lld cannot parse. Because the new GROUP() linker script is only written behind the existing if [ ! -e ... ] guard, rerunning bootstrap after taking this commit leaves the stale archive in place and the static bindgen/LTO link still fails; replace or validate an existing generated archive instead of skipping solely on existence.
Useful? React with 👍 / 👎.
gabsow
left a comment
There was a problem hiding this comment.
Omer's fail-fast commit LGTM — reviewed and verified:
link_tools_for_fresh_shellsis only called frominstall_from_tarball, so the native apt/dnf/apk paths (tools in /usr/bin, not $INSTALL_DIR/bin) never run it — no regression there.- Propagation is real:
install_llvm.shrunsset -eo pipefail,install_from_tarballis invoked as bare statements, andinstall_script.shis alsoset -e— soreturn 1genuinely fails bootstrap instead of the old silent|| true/|| continue(which is exactly how the missingld.lld-Nsymlink slipped through before). - The version-suffix fallback is preserved, so it doesn't spuriously fail: ran the tarball path on
amazonlinux:2023—install_llvm.shexits 0 with all symlinks created (clang-21, ld.lld, ld.lld-21→ld.lld, llvm-config) and resolvable on PATH.
(Can't hit the Approve button — it's my own PR — but consider this an approve.)
…ml changes (#15442) Follow-up to #15253 (bundled data-type modules). Adds a GitHub Actions workflow (`.github/workflows/modules-build-flow.yml`) that replays the from-source flow documented in [modules/README.md](https://github.com/redis/redis/blob/unstable/modules/README.md) on **every OS the bundled modules support** — the same 15-OS list the modules' own nightlies build against — across **x64 and arm64**, each in a **clean stock container** (no Dockerfiles): ``` make modules-update # clone each module pinned in modules.yaml make bootstrap # per-module build/test prereqs make -j all BUILD_TLS=yes # Redis + all modules (LTO=1 via redisearch build_env) ./src/redis-server redis-full.conf + redis-cli MODULE LIST # smoke test ``` ### When it runs - **On pull requests that change `modules/modules.yaml`.** Bumping a module's pinned `ref` is exactly when the from-source build/load can break on some OS, so the whole matrix re-verifies then. On a PR it checks out the PR merge ref, so it builds the **bumped pins**, not `unstable` (works for fork PRs too). - **`workflow_dispatch`** for manual runs, with `use_repo`/`use_git_ref` inputs to point at any repo/branch. It **builds and smoke-tests only** — starts the server and asserts `MODULE LIST` contains `bf`/`search`/`ReJSON`/`timeseries`. It does **not** run the per-module `make test all` suites; those live in each module's own CI. ### Design - **Clean containers, no Dockerfiles** — one matrix job per `arch × osnick`; every image is a stock multi-arch base (ubuntu/debian/alma/rocky/amazonlinux/azurelinux/alpine). - **Prereqs = only what the manual assumes present** before its first command (git, make, CA certs; `gawk`/`findutils` on minimal rpm images; `bash` on alpine; `openssl` + dev headers). Compilers and per-module toolchains must come from `make bootstrap` — if they don't, the manual is broken on that OS and this workflow catches exactly that. - **`BUILD_TLS=yes`** — the README's documented full-build flag (redisearch's TLS test env expects it). - **No node-based actions inside containers** (plain `git clone`) — they can't start on older-glibc images. ### Validation Ran the full matrix on a fork against the upcoming module refs (redisearch + redistimeseries at `master`, i.e. post-RediSearch#10372): **30/30 jobs green** across all 15 OSes on both arches — build + `MODULE LIST` smoke (fork Actions run `29747001924`). Once `modules.yaml` is bumped to the retagged versions carrying the merged bootstrap/LTO fixes (RediSearch [#10372](RediSearch/RediSearch#10372) / [#10373](RediSearch/RediSearch#10373), RedisTimeSeries [#2089](RedisTimeSeries/RedisTimeSeries#2089)), the matrix is green with no per-module workarounds in the workflow. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Adds CI-only automation with no changes to Redis runtime, auth, or data paths. > > **Overview** > Adds **`.github/workflows/modules-build-flow.yml`**, a GitHub Actions workflow that replays the documented from-source modules flow (`make modules-update` → `make bootstrap` → `make all BUILD_TLS=yes`) inside **stock** container images on **x64 and arm64** across **15 OS variants** (Ubuntu, Debian, Alma/Rocky, Amazon Linux 2023, Azure Linux 3, Alpine). > > It runs on **PRs that touch `modules/modules.yaml`** and on **`workflow_dispatch`** (optional repo/ref). Each job installs only the manual’s baseline packages (git, make, TLS/openssl tooling, etc.), uses a **plain `git fetch` checkout** (including the PR merge ref on path-filtered PRs) instead of `actions/checkout`, then **starts `redis-server` with `redis-full.conf`** and asserts **`MODULE LIST`** includes **bf**, **search**, **ReJSON**, and **timeseries**. > > The workflow also encodes several container-specific fixes: pinned **`PATH`** after bootstrap, job-level **`CXXFLAGS`** for GCC/clang `-Werror` noise, **`rm /.dockerenv`** so module bootstrap installs test Python envs, and **tdnf install retries** on Azure Linux. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 80d2e37. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Claude Fable 5 <[email protected]> Co-authored-by: TalBarYakar <[email protected]>



Companion to #10372 (same theme:
make bootstrapshould fully provision what the documented flows need).Problem
install_llvm.sh's package-manager paths (apt / apt.llvm.org / apk / dnf) land versioned binaries in/usr/bin, so aftermake bootstrapa later shell can runmake build LTO=1andbuild.shfindsclang-21/lld-21. The tarball fallback (Azure Linux, Mariner, any distro without matching packages) unpacks to/usr/local/llvmand wires PATH only via$GITHUB_PATH/the current shell - so outside GitHub Actions, a fresh shell can't see the toolchain: LTO refuses to enable (Please either: 1. Install clang-21 ...) even though bootstrap just installed it, and bindgen has no libclang.Fix
After extracting the tarball, symlink the tools
build.shlooks up (clang-21,clang++-21,lld-21,ld.lld-21,ld.lld) andllvm-config- through which bindgen's clang-sys resolves libclang (llvm-config --libdir), so no persistedLIBCLANG_PATHis needed - into/usr/local/bin(default PATH everywhere). This mirrors what the package paths already provide, and the same patternrocky_linux_8.shuses for its gcc-toolset shims.The follow-up commit also fixes the related LTO bootstrap issues found while validating the Redis bundled-modules flow: native apt installs
llvm-21for CMake IPO archive tools, Alpine uses aGROUP()linker script for static LLVM libs, Azure Linux retries flakytdnfmetadata fetches, Rocky 8 installslld, andbuild.shkeeps LTO enabled when reusing an LTO-configured build directory.Verified
Clean
mcr.microsoft.com/azurelinux/base/core:3.0container ->./install_llvm.sh-> then a deliberately clean shell (env -i PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin):The broader LTO validation is for supported Linux targets where RediSearch/Redis build sanity enables LTO. macOS and explicitly non-LTO rows remain outside this claim.
Context: found while wiring the redis/redis bundled-modules flow (redis/redis#15253), whose docs currently tell users bootstrap can't provision the LTO toolchain.
Release Notes
Generated with Claude Code