Description of the problem / feature request:
Bazel fails with;
No matching toolchains found for types @bazel_tools//tools/cpp:toolchain_type.
When target should have been skipped.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Create a workspace with;
- WORKSPACE (empty)
- main.cc (any valid cc)
- BUILD.bazel (contents below)
cc_binary(
name = "main",
srcs = ["main.cc"],
target_compatible_with = select({
"@platforms//os:linux": [],
"@platforms//os:macos": [],
"@platforms//os:windows": [],
"//conditions:default": ["@platforms//:incompatible"],
}),
)
platform(
name = "no_os",
constraint_values = [
"@platforms//os:none",
],
)
Try to build with no_os platform e.g.
bazel build //... --platforms=//:no_os
ERROR: /home/user/projects/bug_repro/BUILD.bazel:1:10: While resolving toolchains for target //:main: No matching toolchains found for types @bazel_tools//tools/cpp:toolchain_type. Maybe --incompatible_use_cc_configure_from_rules_cc has been flipped and there is no default C++ toolchain added in the WORKSPACE file? See https://github.com/bazelbuild/bazel/issues/10134 for details and migration instructions.
ERROR: Analysis of target '//:main' failed; build aborted:
INFO: Elapsed time: 0.465s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 0 targets configured)
In this case I would expect bazel to skip toolchain resolution for //:main as it is incompatible,
Note that #10134 seems to unrelated to this issue.
What operating system are you running Bazel on?
Ubuntu 20.04 under WSL2
What's the output of bazel info release?
release 5.0.0
Have you found anything relevant by searching the web?
No
Any other information, logs, or outputs that you want to share?
No
Description of the problem / feature request:
Bazel fails with;
No matching toolchains found for types @bazel_tools//tools/cpp:toolchain_type.When target should have been skipped.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Create a workspace with;
Try to build with
no_osplatform e.g.In this case I would expect bazel to skip toolchain resolution for
//:mainas it is incompatible,Note that #10134 seems to unrelated to this issue.
What operating system are you running Bazel on?
Ubuntu 20.04 under WSL2
What's the output of
bazel info release?release 5.0.0
Have you found anything relevant by searching the web?
No
Any other information, logs, or outputs that you want to share?
No