Repository navigation
fix(bootstrap): Clang_ROOT pinned to the LLVM recipe install - #1341
Merged
Merged
Conversation
A recipe can list several <Package>_ROOT names ("package_root_var"
accepts a string or a list). The LLVM recipe lists LLVM_ROOT and
Clang_ROOT, so the generated user preset sets both to the same install
dir. Before, the base presets took Clang_ROOT from $env{LLVM_ROOT} and
the generated preset overrode only LLVM_ROOT, so a stale LLVM_ROOT in
the shell sent find_package(Clang) to another install (Homebrew), which
fails with "imported targets are referenced, but are missing: LLVM".
setup-llvm.cmake now validates Clang_ROOT (the old branch set LLVM_ROOT
to itself), rejects a Clang_ROOT that differs from LLVM_ROOT, checks for
lib/cmake/clang, and fails with a clear message when the found Clang
and LLVM come from different prefixes.
Root aliases are not part of the recipe stamp, so no dependency is
rebuilt.
Fixes cppalliance#1337
alandefreitas
enabled auto-merge
October 6, 2026 18:07
Contributor
|
| Scope | Lines Δ% | Lines Δ | Lines + | Lines - | Files Δ | Files + | Files ~ | Files ↔ | Files - |
|---|---|---|---|---|---|---|---|---|---|
| 🔧 Toolchain Tests | 59% | 88 | 88 | - | 2 | - | 2 | - | - |
| 🔧 Toolchain | 22% | 33 | 26 | 7 | 4 | - | 4 | - | - |
| 🛠️ Source | 18% | 27 | 26 | 1 | 1 | - | 1 | - | - |
| Total | 100% | 148 | 140 | 8 | 7 | - | 7 | - | - |
Legend: Files + (added), Files ~ (modified), Files ↔ (renamed), Files - (removed)
🔝 Top Files
- utils/bootstrap/tests/test_archive_fetcher_loader.py (Toolchain Tests): 50 lines Δ (+50 / -0)
- utils/bootstrap/tests/test_installer.py (Toolchain Tests): 38 lines Δ (+38 / -0)
- src/setup-llvm.cmake (Source): 27 lines Δ (+26 / -1)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1341 +/- ##
===========================================
+ Coverage 79.15% 83.21% +4.05%
===========================================
Files 384 35 -349
Lines 39441 3670 -35771
Branches 7848 845 -7003
===========================================
- Hits 31221 3054 -28167
+ Misses 5362 410 -4952
+ Partials 2858 206 -2652
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:
|
|
An automated preview of the documentation is available at https://1341.mrdocs.prtest2.cppalliance.org/index.html If more commits are pushed to the pull request, the docs will rebuild at the same URL. 2026-10-06 18:12:37 UTC |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes the build failure in #1337. A fresh clone of MrDocs does not configure on a Mac that has Homebrew LLVM installed when the shell exports the LLVM root variable, which is common with Homebrew. The base presets read the Clang root from that environment variable. The preset the bootstrap writes overrides only the LLVM root. CMake then takes LLVM from our own build and Clang from Homebrew, and Homebrew's Clang refuses to load because the LLVM it expects is not the one already in the project. The bootstrap is the documented path for anyone without a binary release, and it fails on the first run, so I would like it in soon. Fixes #1337
Changes
A recipe lists every root variable its install must satisfy, one or several. The LLVM recipe lists the LLVM and the Clang roots, so the generated preset points both at the same install. The CMake setup for LLVM checks that the Clang root matches the LLVM root and holds a Clang package. After both packages load, it also checks that they come from the same prefix. Each check stops with a message that names the two paths and the environment variable. The extra root names stay out of the build stamp, so nobody rebuilds LLVM after pulling this.
Testing
The bootstrap unit tests cover the list form of the recipe field, the installer registering every root, and the stamp staying unchanged. I reproduced the reporter's setup locally, and it now stops at configure with the new message.
Documentation
No documentation changes. The recipe files are the only place that describes their fields, and the error messages say what to do.