You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Imagine you're running Bazel on a Mac, but you're making use of a remote execution service that provides workers for both Linux and macOS. You want to prefer the use of Linux workers over macOS, so your .bazelrc looks like this:
This is caused by the fact that @rules_rust//tools/rustfmt:rustfmt has data = ["//rust/toolchain:current_rustfmt_toolchain"]. The latter is only intended to be used as part of ctx.actions.run() (the 'exec' platform). In this case we require that a copy of rustfmt is used for the 'target' platform.
The toolchain_files() and current_rust_toolchain() rules return files
for the current 'exec' platform. This is perfecly reasonable if you want
to use these tools as part of ctx.actions.run(). But if you want to use
these as part of 'data = []' (runfiles), they must be built for the
target.
Fixes: #2684
Imagine you're running Bazel on a Mac, but you're making use of a remote execution service that provides workers for both Linux and macOS. You want to prefer the use of Linux workers over macOS, so your .bazelrc looks like this:
Now if we invoke
@rules_rust//:rustfmt
, we see the following:This is caused by the fact that
@rules_rust//tools/rustfmt:rustfmt
hasdata = ["//rust/toolchain:current_rustfmt_toolchain"]
. The latter is only intended to be used as part ofctx.actions.run()
(the 'exec' platform). In this case we require that a copy of rustfmt is used for the 'target' platform.For similar mishaps, see bazelbuild/bazel#19645 and bazel-contrib/rules_oci#590.
The text was updated successfully, but these errors were encountered: