J.Z
J.Z

Reputation: 419

Solve dependency issue when using gRPC cpp in 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!

Upvotes: 3

Views: 2279

Answers (1)

Rohan Singh
Rohan Singh

Reputation: 21445

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")

Upvotes: 10

Related Questions