BUILD target visibility broken by upcoming Bazel 6.0 release #58168
Labels
stat:awaiting tensorflower
Status - Awaiting response from tensorflower
subtype:bazel
Bazel related Build_Installation issues
type:build/install
Build and install issues
Issue Type
Build/Install
Source
source
Tensorflow Version
Near-HEAD
Custom Code
No
OS Platform and Distribution
No response
Mobile device
No response
Python version
No response
Bazel version
pre-6.0
GCC/Compiler version
No response
CUDA/cuDNN version
No response
GPU model and memory
No response
Current Behaviour?
Tensorflow's build will break in Bazel 6.0 due to a bugfix in the behavior of
package_group
. (See Bazel CI run)The target
//tensorflow/compiler/xla/mlir/transforms/runtime:calling_convention
depends on//tensorflow/compiler/xla/mlir/ir/runtime:rt
, and is granted visibility via the latter'sdefault_visibility
of@tf_runtime//:friends
. Thisfriends
package group contains//...
, which under pre-6.0 behavior grants visibility to everyone (effectively public). The corrected behavior is that it grants visibility only to all packages within the same repo as that package group, i.e., to packages under @tf_runtime.If you want the behavior of the package group to be "visible to all packages, everywhere", you can replace
//...
with the special string constantpublic
, which is new to Bazel 6.0. This will break compatibility with prior Bazel versions. Note that there is no direct way for a package group to specify "visible to the following packages that live outside of my own repo".Alternatively, you can rewrite the
default_visibility
intensorflow/compiler/xla/mlir/ir/runtime/BUILD
to//visibility:public
, because that's effectively what it already is; or you can determine a more suitable narrower visibility definition.Finally, you can opt out of this change for your build by passing
--incompatible_fix_package_group_reporoot_syntax=false
in Bazel 6.0. This is particularly helpful if you want to migrate to usepublic
for any package groups in the meantimeSee bazelbuild/bazel#16323 for more information.
Standalone code to reproduce the issue
Build at head Bazel.
Relevant log output
No response
The text was updated successfully, but these errors were encountered: