Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solve dependency issue when using gRPC cpp in bazel

Tags:

grpc

bazel

I am trying to run a simple program with gRPC in dependency. I tried several examples but continuesly get the following error:

ERROR: /home/git/examples/WORKSPACE:1:1: name 'git_repository' is not defined
ERROR: Error evaluating WORKSPACE file

This is my bazel version:

➜ git:(master) ✗ bazel version
Build label: 0.23.2

And this is the workspace file content:

git_repository(
    name = "com_github_grpc_grpc",
    commit = "ac0808b107d73613191b66617a547a201871a845",
    remote = "https://github.com/grpc/grpc.git",
)

load("@com_github_grpc_grpc//:bazel/grpc_deps.bzl", "grpc_deps")

grpc_deps()

bind(
    name = "grpc_cpp_plugin",
    actual = "@com_github_grpc_grpc//:grpc_cpp_plugin",
)

bind(
    name = "grpc++_codegen_proto",
    actual = "@com_github_grpc_grpc//:grpc++_codegen_proto",
)

Any help will be appreciated!

like image 788
J.Z Avatar asked Apr 09 '26 17:04

J.Z


1 Answers

git_repository is no longer a native rule. You need to include it at the top of your WORKSPACE with:

load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
like image 114
Rohan Singh Avatar answered Apr 14 '26 22:04

Rohan Singh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!