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

Kythe and Protobuf are failing with Release 7.0 #19973

Closed
sgowroji opened this issue Oct 30, 2023 · 11 comments
Closed

Kythe and Protobuf are failing with Release 7.0 #19973

sgowroji opened this issue Oct 30, 2023 · 11 comments
Assignees
Labels
area-Bzlmod Bzlmod-specific PRs, issues, and feature requests P1 I'll work on this now. (Assignee required) team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: bug

Comments

@sgowroji
Copy link
Member

Kythe :

https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/3379#_

Platform: Ubuntu

Logs:

ERROR: no such package '@io_kythe//kythe/data': The repository '@io_kythe' could not be resolved: Repository '@io_kythe' is not defined
(03:57:19) ERROR: /var/lib/buildkite-agent/builds/bk-docker-r8lq/bazel-downstream-projects/kythe/WORKSPACE:63:19: no such package '@io_kythe//kythe/data': The repository '@io_kythe' could not be resolved: Repository '@io_kythe' is not defined and referenced by '//external:vnames_config'
(03:57:19) ERROR: Analysis of target '//kythe/cxx/indexer/cxx/testdata/proto:proto_semantic_ref_aw_test_proto_kzip' failed; build aborted: Analysis failed
(03:57:19) INFO: Elapsed time: 1.389s, Critical Path: 0.04s
(03:57:19) INFO: 1 process: 1 internal.
(03:57:19) ERROR: Build did NOT complete successfully
(03:57:19) FAILED:

Steps:

git clone -v https://github.com/kythe/kythe.git
git reset 47d8a9a27d280e7c71150a1b267f46790ead5fb7 --hard
export USE_BAZEL_VERSION=b3a83a3a3dab0b87952b67cfc7ea8516eabeec4b
sudo apt update && sudo apt -y install bison flex uuid-dev asciidoc graphviz source-highlight
bazel build //kythe/...

Protobuf

https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/3379#018b2723-e292-48fc-8571-d7d09097bced

Platform : Windows, MacOs, Ubuntu

Logs:

ERROR: no such package '@com_google_protobuf//': The repository '@com_google_protobuf' could not be resolved: Repository '@com_google_protobuf' is not defined
(03:55:15) ERROR: /var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/a270cf9078705688cac67ea00d82328b/external/bazel_tools/tools/proto/BUILD:10:6: no such package '@com_google_protobuf//': The repository '@com_google_protobuf' could not be resolved: Repository '@com_google_protobuf' is not defined and referenced by '@bazel_tools//tools/proto:protoc'
(03:55:15) ERROR: Analysis of target '//java/core:conformance_test' failed; build aborted: Analysis failed
(03:55:15) INFO: Elapsed time: 1.367s, Critical Path: 0.03s
(03:55:15) INFO: 1 process: 1 internal.
(03:55:15) ERROR: Build did NOT complete successfully
(03:55:15) ERROR: No test targets were found, yet testing was requested
(03:55:15) FAILED:

Steps:

git clone -v https://github.com/google/protobuf.git
git reset 42fe8b9927911cc81bf9a47c680c34b4413ee179 --hard
export USE_BAZEL_VERSION=b3a83a3a3dab0b87952b67cfc7ea8516eabeec4b
bazel test  --proto_toolchain_for_cc=//:cc_toolchain //:all //java/...

Reference : kythe/kythe#5893 (comment)

CC Greenteam @comius @meteorcloudy

@sgowroji sgowroji added release blocker team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website area-Bzlmod Bzlmod-specific PRs, issues, and feature requests type: bug labels Oct 30, 2023
@sgowroji sgowroji changed the title Kythe and Protobuff are failing with Release 7.0 Kythe and Protobuf are failing with Release 7.0 Oct 30, 2023
@meteorcloudy
Copy link
Member

@bazel-io fork 7.0.0

@Wyverald Wyverald self-assigned this Oct 30, 2023
@Wyverald Wyverald added the P1 I'll work on this now. (Assignee required) label Oct 30, 2023
@Wyverald
Copy link
Member

Both failures can be traced back to the removal of the implicit local_repository(name="$WORKSPACE_NAME", path=".") clause in 9be1be9.

The Kythe failure is due to usage of bind (https://github.com/kythe/kythe/blob/80d78947efb899a4f81bd6ce8e2118e925f8f05e/external.bzl#L1777), which does not respect repo mapping at all (see https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/packages/WorkspaceGlobals.java;drc=9be1be93ff17dbb4cf0effb4f885911ec99cc30c;l=139)

The Protobuf failure is much more annoying... @bazel_tools//tools/proto:BUILD defines a few aliases pointing into @com_google_protobuf. But since bazel_tools is injected in a WORKSPACE prefix, which happens before the workspace call, these aliases don't know that @com_google_protobuf actually means @ (the main repo). Luckily this is a WORKSPACE-only problem (goes away with --enable_bzlmod and a minimal MODULE.bazel file containing module(name='protobuf',repo_name='com_google_protobuf')). But given protocolbuffers/protobuf#14313, this might be rather tricky to tackle.

I'll try to fix the Kythe failure first.

@Wyverald Wyverald added team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. and removed team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website labels Oct 31, 2023
Wyverald added a commit that referenced this issue Oct 31, 2023
@Wyverald
Copy link
Member

For the Protobuf failure, I'm considering just adding an explicit local_repository(name="com_google_protobuf", path=".") line to protobuf's WORKSPACE. This only affects Protobuf's own build and immediately alleviates the problem, without us having to migrate it to Bzlmod first.

Wyverald added a commit to Wyverald/protobuf that referenced this issue Oct 31, 2023
copybara-service bot pushed a commit to protocolbuffers/protobuf that referenced this issue Nov 2, 2023
To keep the build working on Bazel 7. See bazelbuild/bazel#19973 (comment) for more info.

PiperOrigin-RevId: 578846156
bazel-io pushed a commit to bazel-io/bazel that referenced this issue Nov 2, 2023
Fixes bazelbuild#19973.

Closes bazelbuild#20012.

PiperOrigin-RevId: 578864227
Change-Id: I8a454446adbdd2b6ad248a7f1d657d2aed151bb7
copybara-service bot pushed a commit to protocolbuffers/protobuf that referenced this issue Nov 2, 2023
To keep the build working on Bazel 7. See bazelbuild/bazel#19973 (comment) for more info.

PiperOrigin-RevId: 578846156
iancha1992 pushed a commit that referenced this issue Nov 2, 2023
Fixes #19973.

Closes #20012.

Commit
c7e391c

PiperOrigin-RevId: 578864227
Change-Id: I8a454446adbdd2b6ad248a7f1d657d2aed151bb7

Co-authored-by: Xdng Yng <[email protected]>
copybara-service bot pushed a commit to protocolbuffers/protobuf that referenced this issue Nov 2, 2023
To keep the build working on Bazel 7. See bazelbuild/bazel#19973 (comment) for more info.

PiperOrigin-RevId: 578846156
copybara-service bot pushed a commit to protocolbuffers/protobuf that referenced this issue Nov 2, 2023
To keep the build working on Bazel 7. See bazelbuild/bazel#19973 (comment) for more info.

PiperOrigin-RevId: 578968403
@Wyverald Wyverald reopened this Nov 6, 2023
@Wyverald
Copy link
Member

Wyverald commented Nov 6, 2023

hmm, Kythe is still failing in downstream (https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/3440#018ba2ca-5fc1-4226-8f57-0d8a2b1d72ad). Re-opening until investigated.

@Wyverald
Copy link
Member

Wyverald commented Nov 9, 2023

It turns out Kythe uses bind within a maybe() macro from @bazel_tools, which causes the actual parameter to be interpreted from @bazel_tools's perspective.

There's really no good way to fix this without just nuking bind. I'm going to push a change to remove the maybe wrapper in Kythe.

@Wyverald Wyverald closed this as completed Nov 9, 2023
@Wyverald
Copy link
Member

Wyverald commented Nov 9, 2023

Sent kythe/kythe#5926

@pdecks
Copy link

pdecks commented Mar 5, 2024

This is still a problem for protobuf. As I noted in protocolbuffers/protobuf#15615, I was able to successfully build using bazel 6.5.0. Both bazel 7.0.0 and 7.0.2 fail.

@debkanchan
Copy link

debkanchan commented Mar 6, 2024

@pdecks Today I hit this bug and I was also able to repro this on 7.0.0 and 7.0.2. Due to this all our CI jobs are failing

@debkanchan
Copy link

Desperately need help here

@debkanchan
Copy link

I was able to pinpoint the issue comes from google.golang.org/protobuf v1.33.0

If you're depending on google.golang.org/protobuf directly in go then add the following line

// HACK: pin protobuf version to fix build failure
replace google.golang.org/protobuf => google.golang.org/protobuf v1.32.0

@debkanchan
Copy link

I was further able to pinpoint the issue here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Bzlmod Bzlmod-specific PRs, issues, and feature requests P1 I'll work on this now. (Assignee required) team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants