-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Toolchain resolution stumbles over workspace prefixes in constraint labels #10927
Comments
I've seen a number of issues recently related to workspace prefixes. I wonder if there's any commonality between them. Regardless, we'll have a chat among configuration devs later this week and bring this up for triaging. Thanks for the detailed description. |
/cc @katre |
FYI I think this concern (better support for workspace prefixes) should be a commitment for Q2. |
Thanks for the update, that's great to hear! |
@gregestren, could you replace the untriaged label with a priority label please? |
Let's consolidate these bugs into #11128. When that one is fixed, it if doesn't address this we can re-open this. |
Note to myself: Here's the worrying code: https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/skyframe/SingleToolchainResolutionFunction.java;drc=780199d619bbec2a7dd695773cc3018d4de6c1e7;l=138 The toolchainType Label from the actual toolchain target is directly compared to the toolchainType Label from the rule (either starlark's rule.toolchains parameter, or a native rule's RuleClass.Builder.addRequiredToolchains). The label from the rule isn't ever resolved, so a target isn't loaded. If it was, we could compare canonical labels and make sure it works, at the expense of an extra ConfiguredTarget lookup (although a cached one, almost certainly). |
See #13381 for details, but this should be fixed in Bazel at head. |
Description of the problem:
Bazel fails to resolve a toolchain if one of the
constraint_values
entries of the current platform is defined without a workspace prefix, while theexec_compatible_with
of the toolchain uses the same constraint but with a workspace prefix. E.g. inrules_nixpkgs
we define the constraint and platform innixpkgs/constraints/BUILD.bazel
asNote the
constraint_values
entry:nixpkgs
without workspace prefix.But in the toolchain we use
Note the fully qualified constraint
@io_tweag_rules_nixpkgs//nixpkgs/constraints:nixpkgs
.The
WORKSPACE
file does specifyworkspace(name = "io_tweag_rules_nixpkgs")
, so those labels indicate the same constraint.Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Checkout tweag/rules_nixpkgs@a897d1a and execute the following command
The test should fail and the log should contain the following lines
What operating system are you running Bazel on?
Ubuntun 19.10
What's the output of
bazel info release
?Also reproducible with 2.1.0.
If
bazel info release
returns "development version" or "(@non-git)", tell us how you built Bazel.Using Nix with the following nixpkgs revision
Have you found anything relevant by searching the web?
This seems related to the following issue #9177
Any other information, logs, or outputs that you want to share?
This is a regression, the issue was not observed in Bazel version 1.1.0.
The text was updated successfully, but these errors were encountered: