解决在bazel中使用gRPC cpp时的依赖性问题 [英] Solve dependency issue when using gRPC cpp in bazel

查看:390
本文介绍了解决在bazel中使用gRPC cpp时的依赖性问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行一个具有gRPC依赖关系的简单程序.我尝试了几个示例,但仍然收到以下错误:

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

这是我的bazel版本:

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

任何帮助将不胜感激!

推荐答案

git_repository 不再是本机规则.您需要在 WORKSPACE 的顶部添加以下内容:

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

这篇关于解决在bazel中使用gRPC cpp时的依赖性问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆