grpc icon indicating copy to clipboard operation
grpc copied to clipboard

Can't build //examples/protos:all using bazel version 7.0.0-pre.20230823.4

Open Dandi007 opened this issue 2 years ago • 9 comments

What version of gRPC and what language are you using?

master branch git commit 66d928c44043bdf24dd7ba157f35c0b65748ba54

What operating system (Linux, Windows,...) and version?

ubuntu 20.04

What runtime / compiler are you using (e.g. python version or version of gcc)

gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2)

What did you do?

run build using bazel

bazel build //examples/protos:all

What did you expect to see?

build complete

What did you see instead?

➜ grpc git:(master) bazel build //examples/protos:all INFO: Repository rules_proto instantiated at: /home/tusen/code/grpc/WORKSPACE:11:16: in /home/tusen/code/grpc/bazel/grpc_extra_deps.bzl:50:18: in grpc_extra_deps /home/tusen/.cache/bazel/_bazel_tusen/2ccd0537f49d4d76ef4487578b783242/external/com_google_protobuf/protobuf_deps.bzl:93:24: in protobuf_deps /home/tusen/.cache/bazel/_bazel_tusen/2ccd0537f49d4d76ef4487578b783242/external/com_google_protobuf/protobuf_deps.bzl:22:17: in _github_archive Repository rule http_archive defined at: /home/tusen/.cache/bazel/_bazel_tusen/2ccd0537f49d4d76ef4487578b783242/external/bazel_tools/tools/build_defs/repo/http.bzl:379:31: in ERROR: Traceback (most recent call last): File "/home/tusen/.cache/bazel/_bazel_tusen/2ccd0537f49d4d76ef4487578b783242/external/build_bazel_rules_apple/apple/internal/rule_support.bzl", line 221, column 36, in deps_cfg = apple_common.multi_arch_split, Error: 'apple_common' value has no field or method 'multi_arch_split' WARNING: Target pattern parsing failed. ERROR: Skipping '//examples/protos:all': while parsing '//examples/protos:all': error loading package 'examples/protos': at /home/tusen/code/grpc/bazel/grpc_build_system.bzl:35:6: at /home/tusen/.cache/bazel/_bazel_tusen/2ccd0537f49d4d76ef4487578b783242/external/build_bazel_rules_apple/apple/ios.bzl:26:5: at /home/tusen/.cache/bazel/_bazel_tusen/2ccd0537f49d4d76ef4487578b783242/external/build_bazel_rules_apple/apple/internal/testing/ios_rules.bzl:22:5: at /home/tusen/.cache/bazel/_bazel_tusen/2ccd0537f49d4d76ef4487578b783242/external/build_bazel_rules_apple/apple/internal/testing/apple_test_bundle_support.bzl:67:5: initialization of module 'apple/internal/rule_support.bzl' failed ERROR: while parsing '//examples/protos:all': error loading package 'examples/protos': at /home/tusen/code/grpc/bazel/grpc_build_system.bzl:35:6: at /home/tusen/.cache/bazel/_bazel_tusen/2ccd0537f49d4d76ef4487578b783242/external/build_bazel_rules_apple/apple/ios.bzl:26:5: at /home/tusen/.cache/bazel/_bazel_tusen/2ccd0537f49d4d76ef4487578b783242/external/build_bazel_rules_apple/apple/internal/testing/ios_rules.bzl:22:5: at /home/tusen/.cache/bazel/_bazel_tusen/2ccd0537f49d4d76ef4487578b783242/external/build_bazel_rules_apple/apple/internal/testing/apple_test_bundle_support.bzl:67:5: initialization of module 'apple/internal/rule_support.bzl' failed INFO: Elapsed time: 1.155s INFO: 0 processes. ERROR: Build did NOT complete successfully Loading: 0 packages loaded currently loading: examples/protos Fetching https://github.com/bazelbuild/rules_proto/archive/f7a30f6f80006b591fa7c437fe5a951eb10bcbcf.zip

Anything else we should know about your project / environment?

Dandi007 avatar Oct 25 '23 09:10 Dandi007

rules_apple is way too old inside gRPC. Upgrading it causes other problems though.

AustinSchuh avatar Oct 25 '23 12:10 AustinSchuh

Please verify the Bazel version you use.

eugeneo avatar Oct 25 '23 16:10 eugeneo

Please verify the Bazel version you use.

release 7.0.0-pre.20231011.2

@eugeneo

Dandi007 avatar Oct 26 '23 02:10 Dandi007

rules_apple is way too old inside gRPC. Upgrading it causes other problems though.

Is there any plan to upgrade it so that user can build grpc with newer bazel version like 7.0.0?

@AustinSchuh

Dandi007 avatar Oct 26 '23 02:10 Dandi007

rules_apple is way too old inside gRPC. Upgrading it causes other problems though.

Is there any plan to upgrade it so that user can build grpc with newer bazel version like 7.0.0?

@AustinSchuh

No clue, I'm a fellow bazel user who is also trying to upgrade to bazel 7 and is blocked by gRPC not supporting bazel 7 yet. I got this far in debugging, then it got hard enough that I don't want to maintain an out of tree patch to upgrade. I shared this to make it easier for someone to get started. (Last time I contributed a fix, it took 2 years to merge. I don't have enough time to do that here)

AustinSchuh avatar Oct 26 '23 06:10 AustinSchuh

Bazel 7 is not yet supported by gRPC. We will work on support once the final version of Bazel 7 is released.

eugeneo avatar Oct 26 '23 17:10 eugeneo

https://releases.bazel.build/7.0.0/release/index.html is now released, any update?

AustinSchuh avatar Dec 11 '23 19:12 AustinSchuh

I believe some work have been done. Have anybody tried building gRPC with Bazel7 now?

eugeneo avatar Jan 24 '24 17:01 eugeneo

We can successfully build grpc with Bazel 7.0.2 and bzlmod, using an old version though:

bazel_dep(name = "protobuf", version = "23.1", repo_name = "com_google_protobuf")
bazel_dep(name = "grpc", version = "1.56.3.bcr.1", repo_name = "com_github_grpc_grpc")

with --enable_bzlmod=false, we get the apple error above.

faximan avatar Mar 13 '24 08:03 faximan

hello I come to join the flock, I'm hitting this same error when trying to use bazel 7.1.1 I'm bulding a project based on googleapis/googleapis WORKSPACE file and only the target /:build_gen works, the rest will give either an apple error or a "this code was built with a different version of protobuf" error depending on the grpc version used in the WORKSPACE file

gattytto avatar Apr 22 '24 04:04 gattytto

This might be closable now -- looks like the .bazelversion in the root of the repository has been saying 7+ since https://github.com/grpc/grpc/pull/36105 in March. Local builds for me got past the rules_apple error mentioned in the description here.

apsaltis-ddog avatar Nov 21 '24 12:11 apsaltis-ddog

Just wanted to confirm that I was able to get this working with bazel 7.3.1, grpc 1.65.0, and protobuf 26.1

harrisonfang-helm avatar Jan 15 '25 21:01 harrisonfang-helm