bazelbuild / bazelbuild/bazel

Add option to disable header inclusion check

Open
#24,926 3 comments 0 reactions 0 assignees View on GitHub
P4 team-Rules-CPP type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the feature request:

In my CI environment, I see builds randomly fail with errors like this (with protobuf-29.3 imported via MODULE.bazel).

```
this rule is missing dependency declarations for the following files included by 'src/google/protobuf/any_lite.cc':
'bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/protobuf~/src/google/protobuf/_virtual_includes/protobuf_lite/google/protobuf/port.h'
```

The randomness of this error plus the need to clean the bazel cache (which doesn't always make the error go away) wastes countless hours of time. I would love to have a flag like `--incompatible-ignore-header-checks` which made these errors non-fatal

### Which category does this issue belong to?

C++ Rules

### What underlying problem are you trying to solve with this feature?

Builds failing due to false positives from header inclusion checks

### Which operating system are you running Bazel on?

Ubuntu 22.04

### What is the output of `bazel info release`?

7.4.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` ?

```text

```

### Have you found anything relevant by searching the web?

_No response_

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

_No response_

Contributor guide

Open the contributing guide

Research direction

Reproduce the reported Bazel 7.4.0 failure with protobuf-29.3 imported through MODULE.bazel, focusing on src/google/protobuf/any_lite.cc and the generated port.h path. Trace the header inclusion check and define coverage for the requested flag so the diagnostic becomes non-fatal while default behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.