Replace hard-coded `-g0` flags with a feature that can be used in the toolchain configuration.
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
Just stumbled across some lingering hard-coded compiler flags:
https://github.com/bazelbuild/bazel/blob/76a849808d48d96588cda665102aa1b31cc0f58d/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java#L1093-L1094
Could these be removed?
Specifically, it'd be nice to have a feature similar to `opt` and `fastbuild` that can be used as a condition to enable flags specifically in the host build. Ideally, I would suggest `host`. This would cause the host build to enable *both* `opt` and `host` features. And in turn, the crosstool configuration could disable debug info in the host build even if it would be enabled as part of the `opt` build for the target.
I noticed this because as implemented, the code actually adds `-g0` twice.
Contributor guide
Research direction
Start with src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java around lines 1093-1094, then trace how opt and fastbuild features are exposed to toolchain configuration. Done means the hard-coded -g0 flags are replaced by configurable host-build behavior, with no duplicate debug-info flag.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, java
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100