Repository navigation
fix(build,windows): work around zccache#619 PCH path-spelling drift - #2685
Conversation
Filed root-cause report upstream: forge-ci/zccache#619 (Windows PCH path-spelling mismatch defeats `#pragma once` across the PCH boundary). This PR ships the targeted workarounds needed to unblock host-build tests against the current Stop-hook policy while the upstream fix lands. Symptom: error: redefinition of 'LogLevel' note: 'C:/.../src\fl/stl/cstdio.h' included multiple times, additional include site here The same physical cstdio.h header was reached via two different canonical path spellings — one with mixed slashes (the literal backslash inserted by clang-on-Windows when joining the `-I` root with the relative include) and one resolved through the PCH cache — and `#pragma once` failed to dedupe. Changes: 1. `ci/meson/shared/meson.build` — replace meson's `/` path-join operator with literal `+ '/' +` concatenation. The `/` operator emits the native separator on Windows (backslash) even when both operands are forward-slash-spelled, which was injecting a trailing backslash into every `-IC:/.../src\` flag and feeding zccache an inconsistent spelling. This is a real bug in our build setup and gets fixed regardless of the upstream zccache work; it just isn't sufficient on its own to clear the dedup failure. 2. Six SOURCE-tree files (`src/fl/...`) — remove redundant direct `#include "fl/stl/cstdio.h"` lines where cstdio.h was already reachable transitively through ostream.h via the PCH. Two of these (istream.h, serial.h) actually used cstdio.h symbols; istream.h forward-declares the one symbol it needs (`fl::available`), serial.h keeps relying on the strstream.h -> ostream.h -> cstdio.h chain that is already in scope. 3. Six TEST-tree files — same fix: remove the redundant direct include. Each gets an explanatory comment referencing zccache#619 so future maintainers can revert the workaround once the upstream fix lands. 4. `src/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_clockless.cpp.hpp` — gate the `esp_rom_printf` call that PR #2684 added under `#ifndef FASTLED_STUB_IMPL`. The function compiles on host stub (where FASTLED_STUB_IMPL is set) and `esp_rom_printf` is undeclared there; the host stub doesn't run the ISR anyway. Verified: `bash test --cpp` -> 249/249 passed on Windows host with zccache 1.11.9 + clang 21.1.5.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (14)
📝 WalkthroughWalkthroughThis PR addresses Windows PCH path-spelling inconsistencies by normalizing Meson-emitted include paths to absolute forward-slash form, removing direct ChangesPCH path workaround and build normalization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related issues
Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Infer (1.2.0)tests/fl/channels/channel_manager.cpptests/fl/channels/channel_manager.cpp:5:10: fatal error: 'fl/channels/manager.h' file not found ... [truncated 1118 characters] ... b/clang/18/include" tests/fl/font/truetype.cpptests/fl/font/truetype.cpp:1:10: fatal error: 'test.h' file not found ... [truncated 1044 characters] ... /install/lib/clang/18/include" tests/fl/stl/stdio.cpptests/fl/stl/stdio.cpp:1:10: fatal error: 'test.h' file not found ... [truncated 1029 characters] ... lang/install/lib/clang/18/include"
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…2686) PR #2685 removed the direct #include "fl/stl/cstdio.h" from src/fl/remote/transport/serial.h based on a transitive-include chain ("strstream.h -> ostream.h -> cstdio.h") that does not exist — strstream.h does NOT include ostream.h, so the symbols fl::available, fl::read, fl::readLine, and fl::println are not in scope on any non-PCH build. CI symptom on the post-#2685 master sha (1a347e9), every teensy variant fails on every example with: fl/remote/transport/serial.h:68:40: error: 'available' is not a member of 'fl' fl/remote/transport/serial.h:69:29: error: 'read' is not a member of 'fl' fl/remote/transport/serial.h:80:16: error: 'readLine' is not a member of 'fl' The Windows PCH path-spelling dedup issue PR #2685 was working around is already handled by the meson.build path-normalization change that shipped in the same PR (replacing meson's `/` operator with literal `'+ '/' +'` concatenation). Dropping the direct include was an incorrect additional belt-and-suspenders that broke every non-PCH build. Verified locally on Windows: bash compile teensy41 --examples Apa102 -> build succeeded in 129.6s -> SUCCESS: Apa102 Co-authored-by: Claude Opus 4.7 <[email protected]>
* docs(skills): add /pch-debug skill and pch_probe.py
A skill that auto-activates on PCH failures ('redefinition of',
'redefines default argument', 'modified since the precompiled header',
tests that pass only after --clean). It explains the identity model
(#pragma once fails early; include guards hide the double read), the two
mechanisms in FastLED's history (path-spelling drift: #2685/zccache#619,
#3813; stale PCH accepted: #4839, #4437, #2995/zccache#710), and a
probe-before-clean procedure.
pch_probe.py: 'inputs' dumps what the PCH recorded (falls back to scanning
the PCH bytes when clang refuses a stale PCH) and flags odd spellings,
duplicate spellings and stale inputs; 'tu' runs a real compile_commands
entry with -H (optionally through zccache) and lists project headers
re-opened from disk next to their PCH spelling.
* pch_probe: llvm-bcanalyzer input records; repo-root-based project-header check (#4860 review)
- inputs: read the PCH with llvm-bcanalyzer -dump when available (PATH or
LLVM_BCANALYZER): exact recorded spelling, size and mtime per input,
without clang's stale-PCH validation; stale = size/mtime differ from the
record (clang's own check). Falls back to -module-file-info / byte scan.
- Project headers are now classified by resolving under the repo root
(derived from the script location), not by matching /src/ or /tests/ in
the raw spelling: relative recorded entries like tests/... count, and any
--build-dir location works.
* pch_probe: resolve relative recorded inputs against the build dir (#4860 review)
Summary
Targets the Windows-only `bash test --cpp` failure that has been blocking the Stop hook after PRs #2683 / #2684. The host-build was failing with "error: redefinition of 'LogLevel'" for a wide swath of TUs (channel_manager, blur, stdio, perf_primitives, font/truetype, several src/ headers) because the same physical `fl/stl/cstdio.h` got two different canonical path spellings — one via the PCH, one via the consumer TU's direct include — and `#pragma once` failed to dedupe across the PCH boundary.
Root cause
Filed upstream as zackees/zccache#619: clang on Windows joins an `-I` root with a relative include using a literal backslash separator (`src\fl/stl/cstdio.h`), and the resulting spelling drifts between PCH-build-time and consumer-TU-time when any include path also carries spelling inconsistency. zccache already has `StrictPathsMode::Consistent` that catches exactly this, but it's off by default.
What this PR changes (until the upstream fix lands)
`ci/meson/shared/meson.build` — fixes one upstream contributor in our own build: replace meson's `/` path-join operator (which emits the native separator on Windows even when the operands are forward-slash spelled) with literal `+ '/' +` concatenation. This cleans up the `-I` flags zccache sees, and is a correct change independent of the upstream work.
Six `src/` files — remove redundant direct `#include "fl/stl/cstdio.h"` lines:
Six `tests/` files — same fix: remove the redundant direct include. PCH reaches cstdio.h transitively via `ostream.h` so test TUs that genuinely use cstdio.h symbols (blur.cpp, stdio.cpp, perf_primitives.hpp) keep working.
`src/platforms/esp/32/drivers/lcd_spi/channel_driver_lcd_clockless.cpp.hpp` — gate the `esp_rom_printf` call that PR chore(lint): clear pre-existing bash-lint baseline failures #2684 added under `#ifndef FASTLED_STUB_IMPL`. The host stub doesn't have `esp_rom_printf` declared.
Each workaround comment references forge-ci/zccache#619 so future maintainers can revert these once the upstream fix lands.
Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit