bazelbuild / bazelbuild/bazel

C++ compiler is selected via a constraint

Open
#25,128 2 comments 0 reactions 0 assignees View on GitHub
P3 team-Configurability team-Rules-CPP type: bug
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 18h
Merged PRs (30d)
75

Description

### Description of the bug:

Bazel selects C++ compiler using a compiler constraint. Because of this, users need to create a new platform for each compiler. This doesn't really match the expectation of what a platform should describe.

The problem is most obvious on Windows, which has several C++ compilers.

### Proposed solution

What should happen instead is that the compiler is selected by `--compiler` flag (that has arbitrary string value). This approach is well tested and works well at Google.

Caveat is that this is now an incompatible change. Compiler constraint was introduced very early, before Bazel team build up experience with platforms and toolchains.

Contributor guide

Open the contributing guide

Research direction

Start by tracing Bazel's compiler constraint selection and the --compiler flag, with particular attention to Windows; the issue names no files or tests. Done means compiler selection uses the arbitrary --compiler value rather than requiring a separate platform for each compiler, while accounting for the incompatible change.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.