Skip to content

fix(bootstrap): Clang_ROOT pinned to the LLVM recipe install - #1341

Merged
alandefreitas merged 1 commit into
cppalliance:developfrom
alandefreitas:fix/clang-root
Oct 6, 2026
Merged

alandefreitas merged 1 commit into
cppalliance:developfrom
alandefreitas:fix/clang-root

Conversation

@alandefreitas

Copy link
Copy Markdown
Collaborator

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.

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
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

⚠️ Warnings

Warning

Source changed but no tests or fixtures were updated.

🧾 Changes by Scope

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)

Generated by 🚫 dangerJS against bf7bbfb

@codecov

codecov Bot commented Oct 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.21%. Comparing base (6a984f6) to head (bf7bbfb).
⚠️ Report is 1 commits behind head on develop.

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     
Flag Coverage Δ
bootstrap 83.21% <100.00%> (+0.09%) ⬆️
cpp ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cppalliance-bot

Copy link
Copy Markdown

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

@alandefreitas
alandefreitas added this pull request to the merge queue Oct 6, 2026
Merged via the queue into cppalliance:develop with commit 2ceca8f Oct 6, 2026
32 checks passed
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.

Build: Fail

2 participants