-
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
Fix toolchains and repo remapping #7755
Comments
/cc @katre |
Something that is probably related to the problem: the toolchain type is defined here and is then imported in all BUILD/bzl files where it's used. Repository renaming does not (and should not) apply to strings. But then when that string is passed to various attributes in toolchain processing, the string should be converted to a label and remapped then. |
Some investigation: This fails:
This works:
Why? Because, when Bazel loads Trying both forms of this does work with bazelbuild/rules_rust. So next step is to figure out what rules_rust is doing differently with the toolchain type. |
I think I see the difference: rules_rust defines the toolchains in a separate (local) external repository, so the toolchain types there are also fully-qualified labels, not local labels. Trying that change now. |
Okay, looking at rules_rust was a red herring. Actual diagnosis is from debugging: Here is the flow:
|
*** Reason for rollback *** Breaks bazel-skylib See #8227 for details. *** Original change description *** Make target pattern parsing repository-renaming aware. Platform and toolchain resolution rely on the target pattern parsing code to turn target pattern strings into Labels. Since most of the target pattern parsing codepaths turn target patterns that originated from the command line, they don't need to pass along the repository renaming map. But instances that affect platform and toolchain target patterns, we need to pass the map. This allows us to turn on the --incompatible_remap_main_repo flag on by default in Bazel. Closes #7902. Fixes #7755, #7773, #7654. RELNOTES: None PiperOrigin-RevId: 246546091
The fix was rolled back, and this still seems broken in bazel 4.1.0. This bug should be re-opened. |
Re-opening this but reducing the priority to reflect that no one is actively working on this. |
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team ( |
@katre Pretty sure this has been fixed as otherwise toolchains wouldn't work with Bzlmod. |
You are correct. |
2398d85 broke bazelbuild/skydoc which already passes --incompatible_remap_main_repo (which gates the behavior that was changed in the PR)
To reproduce:
devbazel test //tests:shell_tests_test_1 --incompatible_remap_main_repo
The error is:
I assume this error is due to not passing the map in all locations that would require it, but I can't find more locations that refer to the toolchain by label
The text was updated successfully, but these errors were encountered: