Skip to content
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

Visibility failure on Bazel 6.0 #23390

Closed
gregestren opened this issue Oct 6, 2022 · 12 comments · Fixed by #23709
Closed

Visibility failure on Bazel 6.0 #23390

gregestren opened this issue Oct 6, 2022 · 12 comments · Fixed by #23709
Assignees

Comments

@gregestren
Copy link

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.

@gregestren gregestren added bug triage Issue requires triage labels Oct 6, 2022
@gregestren
Copy link
Author

CC @meteorcloudy

@ggreenway ggreenway added area/build and removed triage Issue requires triage labels Oct 6, 2022
@ggreenway
Copy link
Contributor

cc @keith @lizan

@lizan
Copy link
Member

lizan commented Oct 6, 2022

Adding package(default_visibility = ["//visibility:public"]) there should be OK. cc @PiotrSikora

@gregestren
Copy link
Author

FYI there's a small wrinkle with aliases (select() -> alias -> config-setting): https://bazel-review.googlesource.com/c/bazel/+/205211.

If you're comfortable with the solution from the above comment, it doesn't matter: ignore this comment entirely.

Just noting because I realize this case has an alias via selects.config_setting_group.

@PiotrSikora
Copy link
Contributor

Adding default_visibility to Proxy-Wasm C++ Host seems like an easy solution. Please send a PR, thanks!

@keith
Copy link
Member

keith commented Oct 6, 2022

@meteorcloudy
Copy link
Contributor

Note that, the flag has been flipped at HEAD, and Envoy is currently failing in downstream: https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/2670#0183ca5c-4612-4980-88f5-86240a1f7c65

@keith
Copy link
Member

keith commented Oct 12, 2022

#23460

keith added a commit to keith/envoy that referenced this issue Oct 12, 2022
meteorcloudy added a commit to bazelbuild/continuous-integration that referenced this issue Oct 13, 2022
meteorcloudy added a commit to bazelbuild/continuous-integration that referenced this issue Oct 13, 2022
@keith
Copy link
Member

keith commented Oct 25, 2022

#23434

@keith keith closed this as completed Oct 25, 2022
@keith keith self-assigned this Oct 25, 2022
@keith
Copy link
Member

keith commented Oct 25, 2022

everything should be fixed here, please lmk if anyone else spots more issues with this!

@SalmaSamy
Copy link

Hi @keith, It looks like Envoy is still failing in the downstream: https://buildkite.com/bazel/bazel-at-head-plus-disabled/builds/1461#0184143d-e174-4fa1-94a6-1b2337dd9476

@keith
Copy link
Member

keith commented Oct 26, 2022

thanks, im interested to hear replies about this on bazelbuild/bazel-skylib#404

@keith keith reopened this Oct 26, 2022
keith added a commit to keith/envoy that referenced this issue Oct 27, 2022
Fixes envoyproxy#23390

This is an edge case, upstream issue: bazelbuild/bazel-skylib#404

Signed-off-by: Keith Smiley <[email protected]>
keith added a commit that referenced this issue Oct 28, 2022
Fixes #23390

This is an edge case, upstream issue: bazelbuild/bazel-skylib#404

Signed-off-by: Keith Smiley <[email protected]>
jwendell pushed a commit to jwendell/envoy that referenced this issue Dec 22, 2022
Fixes envoyproxy#23390

This is an edge case, upstream issue: bazelbuild/bazel-skylib#404

Signed-off-by: Keith Smiley <[email protected]>
Signed-off-by: Jonh Wendell <[email protected]>
fmeum pushed a commit to fmeum/continuous-integration that referenced this issue Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants