Skip to content

[regression] Bazel 9 Cpp inclusion checking fails on Windows due to case sensitivity #28803

@yuzhy8701

Description

@yuzhy8701

Description of the bug:

We use a custom toolchain with hermetic msvc headers. When updating from bazel 8 to bazel 9, inclusion check errors started happening on those headers on Windows:

Compiling toolchains/cc/example/main/hello-greet.cc failed: undeclared inclusion(s) in rule '@@goldfish_build+//toolchains/cc/example/main:hello-greet':
this rule is missing dependency declarations for the following files included by 'toolchains/cc/example/main/hello-greet.cc':
  'external/goldfish_build++toolchain+windows_sdk_hermetic/Include/shared/BaseTsd.h'

We put in the following workaround with the headers filegroup:

Instead of writing:

srcs = glob(["Include/**"])

We have to explicitly add some files with the exactly same case as how they are included:

srcs = glob(["msvc/Include/**"]) + [
        "include/shared/BaseTsd.h",
        "include/um/DSound.h",
        "include/um/Ole2.h",
        "include/um/OleCtl.h",
        "include/shared/WlanTypes.h",
        "include/um/Tlhelp32.h",
        "include/shared/SpecStrings.h",
        "include/um/OCIdl.h",
],

However this workaround breaks if I'm building from a linux host with Windows remote executor, because include/shared/BaseTsd.h is the wrong case and doesn't exist on linux.

Which category does this issue belong to?

C++ Rules

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

No response

Which operating system are you running Bazel on?

Windows

What is the output of bazel info release?

9.0.0

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?


If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

Didn't do a bisect but reading the codebase I highly suspect 6728e38 is the cause.

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions