Skip to content

Build: normalize all Meson -I paths to forward-slash absolute form #2328

Closed

Description

@zackees

Background

Follow-up from #2324 / #2325 / #2327.

On Windows builds the clang compile line for test DLLs contains a mix of path spellings for -I flags:

-Ici/meson/native\fastled.dll.p         ← mixed: fwd then backslash
-Ici/meson/native                       ← fwd relative
-I..\..\ci\meson\native                 ← native backslash relative
-IC:/Users/niteris/dev/fastled6/.       ← abs fwd, trailing /.
-IC:/Users/niteris/dev/fastled6/src     ← abs fwd, clean
-IC:/Users/niteris/dev/fastled6/src/platforms/stub
-Itests                                 ← fwd relative
-Itests\fl_audio_detector_vibe.dll.p    ← mixed

Why this matters:

  • Clang's #pragma once deduplication keys on the resolved-path string. If a header is included through two -I flags that spell the same directory differently, clang treats them as different files and #pragma once is silently defeated.
  • On Windows clang-tool-chain with MinGW, some header paths come back ALL-NATIVE backslash in diagnostics (e.g. C:\Users\niteris\dev\fastled6\src\fl\audio\audio_processor.h) while others come back mixed. This strongly suggests the identity check is comparing raw un-normalized strings.
  • The #2324 → #2325 incident had vibe.h redefined because the src directory was passed as both C:/.../fastled6/./src (tests) and C:/.../fastled6/src (fastled_lib). refactor(tests): drop _project_root_fwd indirection; align test -I paths with rest of codebase #2327 removes the ./src spelling; this issue tracks the remaining inconsistencies.

Remaining inconsistencies

Meson auto-generates relative -I flags for every target (private build dir, source subdir, etc.). On Windows these come out with native backslashes or mixed slashes:

-I..\..\ci\meson\native
-Itests\fl_audio_detector_vibe.dll.p
-Ici/meson/native\fastled.dll.p

None of these currently affect src/** header resolution (they only map into ci/meson/native/ and tests/), but they're a latent trap: if a future header is added under one of those relative roots, we'll hit the same class of bug again.

Desired end state

Every -I flag passed to the compiler is:

  1. Absolute
  2. Forward-slash normalized
  3. Spelled identically across PCH build, fastled_lib, crash_handler_lib, test DLLs, example DLLs

Specifically:

Dir Canonical spelling
project root C:/Users/.../fastled6
src C:/Users/.../fastled6/src
src/platforms/stub C:/Users/.../fastled6/src/platforms/stub
tests C:/Users/.../fastled6/tests
build subdirs (.p) C:/Users/.../fastled6/.build/meson-quick/...

No ./ in the middle. No backslashes. No relative paths.

Options

  1. Meson-side fix: force all include_directories(...) to be absolute and forward-slash. This requires auditing every call site and probably writing a helper in ci/meson/shared/ that wraps include_directories() to enforce the canonical form.
  2. Wrapper-side fix: a compiler wrapper (either the existing zccache or a new one ahead of it) normalizes -I arguments before calling the real compiler. See companion issue for a zccache --strict-paths feature request.
  3. Both: meson-side for what's tractable; wrapper-side as a safety net for what Meson auto-generates.

Option (3) is the most robust and is what this issue proposes.

Acceptance

  • A new test in tests/ or ci/tests/ that inspects compile_commands.json after setup and fails if any -I flag is non-absolute or contains a backslash.
  • bash test --cpp passes without the #ifndef FL_AUDIO_DETECTOR_VIBE_H guard in src/fl/audio/detector/vibe.h (i.e. #pragma once alone is sufficient once paths are consistent).
  • Once the above passes, the #ifndef guard added in fix(audio): add #ifndef guards to vibe.h for PCH-safe inclusion #2325 can be reverted.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions