clang-scan-deps before LLVM 19 has no -o, so with an LLVM 18 toolchain every C++ source fails its scan #52

Closed
opened 2026-11-27 09:24:48 +00:00 by jorijnvdgraaf · 0 comments

Summary

Since 6.4.2 a build reads what each .cppm and .cpp declares and imports with clang-scan-deps -format=p1689 -o <file> -- <compile command>. clang-scan-deps has had -o since LLVM 19: the option is in clang/tools/clang-scan-deps/Opts.td at llvmorg-19.1.0 and not at llvmorg-18.1.8. LLVM 18's clang-scan-deps exits 1 on an option it does not know (ParseArgs in its ClangScanDeps.cpp). So with an LLVM 18 toolchain, named by CRAFTER_BUILD_LLVM_DIR or found first on PATH outside the Flatpak, every build with a C++ source would fail at its first scan. Nothing says which LLVM releases crafter-build supports.

Not run: no LLVM 18 was at hand. The Flatpak carries LLVM 23.1.2 and the development machine has 23.1.3, and both scan. LLVM 18's clang-scan-deps does write the make-style dependency file of -MD -MF in P1689 mode (MakeformatOutputPath in its ClangScanDeps.cpp), which the scan cache needs.

Line numbers refer to 578a1da (6.4.2).

Where

  • implementations/Crafter.Build-Clang.cpp:1155, ScanSource: the scan's command, -o before --.
  • implementations/Crafter.Build-Platform.cpp:707, RunCommandChecked: every build step runs as <command> 2>&1 through popen.
  • AGENTS.template.md:43: the prerequisites name clang-scan-deps, and no release.

Proposal

State LLVM 19 as the oldest release crafter-build supports, in the prerequisites of AGENTS.template.md. GetToolchain() could also refuse an older clang with one message, as Build() reports a missing compiler once rather than per unit.

The other way is to take the description from clang-scan-deps' standard output, which every release writes it to. The redirect would have to sit in a subshell, ( clang-scan-deps … > <file> ): RunCommandChecked appends 2>&1 after the command, and <command> > <file> 2>&1 would send the errors into the file too.

Not looked at

Whether anything else in crafter-build needs a newer LLVM than 18.

## Summary Since 6.4.2 a build reads what each `.cppm` and `.cpp` declares and imports with `clang-scan-deps -format=p1689 -o <file> -- <compile command>`. clang-scan-deps has had `-o` since LLVM 19: the option is in `clang/tools/clang-scan-deps/Opts.td` at `llvmorg-19.1.0` and not at `llvmorg-18.1.8`. LLVM 18's clang-scan-deps exits 1 on an option it does not know (`ParseArgs` in its `ClangScanDeps.cpp`). So with an LLVM 18 toolchain, named by `CRAFTER_BUILD_LLVM_DIR` or found first on `PATH` outside the Flatpak, every build with a C++ source would fail at its first scan. Nothing says which LLVM releases crafter-build supports. Not run: no LLVM 18 was at hand. The Flatpak carries LLVM 23.1.2 and the development machine has 23.1.3, and both scan. LLVM 18's clang-scan-deps does write the make-style dependency file of `-MD -MF` in P1689 mode (`MakeformatOutputPath` in its `ClangScanDeps.cpp`), which the scan cache needs. Line numbers refer to `578a1da` (6.4.2). ## Where - `implementations/Crafter.Build-Clang.cpp:1155`, `ScanSource`: the scan's command, `-o` before `--`. - `implementations/Crafter.Build-Platform.cpp:707`, `RunCommandChecked`: every build step runs as `<command> 2>&1` through `popen`. - `AGENTS.template.md:43`: the prerequisites name clang-scan-deps, and no release. ## Proposal State LLVM 19 as the oldest release crafter-build supports, in the prerequisites of AGENTS.template.md. `GetToolchain()` could also refuse an older clang with one message, as `Build()` reports a missing compiler once rather than per unit. The other way is to take the description from clang-scan-deps' standard output, which every release writes it to. The redirect would have to sit in a subshell, `( clang-scan-deps … > <file> )`: `RunCommandChecked` appends `2>&1` after the command, and `<command> > <file> 2>&1` would send the errors into the file too. ## Not looked at Whether anything else in crafter-build needs a newer LLVM than 18.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Catcrafts/Crafter.Build#52
No description provided.