Incremental build correctness issue: Execution crashes after modifying a file, works only after bazel clean
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 75
Description
### Description of the bug:
I encountered an incremental build correctness issue. When I modify a specific file and run `bazel build`, the build succeeds, but the resulting executable crashes at runtime. However, if I run `bazel clean` and then `bazel build` again, the executable works perfectly.
This suggests that Bazel is using a stale cache or missing a dependency invalidation during the incremental build.
### 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?
macos
### What is the output of `bazel info release`?
release 9.1.1
### 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
```
### If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.
_No response_
### 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
Research direction
The report names no files, tests, or minimal reproducer. First obtain a reproducible incremental-build case on macOS with Bazel 9.1.1 and capture the modified file and build output; done means the incremental build produces an executable that behaves like a clean build after the same modification.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, macos
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100