Skip to content

Visibility failure on Bazel 6.0 #23390

@gregestren

Description

@gregestren

Title: Visibility failure on Bazel 6.0

Description:
Bazel 6.0 pre-release tests show envoy failing with --incompatible_enforce_config_setting_visibility.

This isn't a surprise. That flag fixes a long-standing omission in Bazel's visibility checking: config_setting has never been visibility-checked. That means that if a config_setting is defined in a package with private visibility, the config_setting is still public. The flag updates config_setting to properly honor visibility.

So flipping the flag makes it possible for existing config_setting references to fail. The fix is to update their visibility to reflect actual usage.

Repro steps:

$ git clone -v https://github.com/envoyproxy/envoy.git
$ USE_BAZEL_VERSION=latest bazel build --nobuild //test/common/common/... //test/integration/... //test/exe/... --incompatible_enforce_config_setting_visibility

ERROR: /usr/local/google/home/gregce/.cache/bazel/_bazel_gregce/160b5d944412957a853c062174d7f0d8/external/proxy_wasm_cpp_host/BUILD:49:11:
in cc_library rule @proxy_wasm_cpp_host//:base_lib: alias '@proxy_wasm_cpp_host//bazel:crypto_system' referring to target 
'@proxy_wasm_cpp_host//bazel:linux_s390x' is not visible from target '@proxy_wasm_cpp_host//:base_lib'. Check the visibility 
declaration of the former target if you think the dependency is legitimate
ERROR: /usr/local/google/home/gregce/.cache/bazel/_bazel_gregce/160b5d944412957a853c062174d7f0d8/external/proxy_wasm_cpp_host/BUILD:49:11:
 Analysis of target '@proxy_wasm_cpp_host//:base_lib' failed
ERROR: Analysis of target '@proxy_wasm_cpp_host//:base_lib' failed; build aborted: 

This leads to these config settings which need broader visibility. One option is adding this to their package:

package(default_visibility = ["//visibility:public"])

Other options here.

I'd write a PR, but I don't understand who owns proxy-wasm-cpp-host vs. envoy and what actual visibility levels the owners want.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions