从源代码构建 gRPC C++
Building gRPC C++ from source
我正在尝试从构建 gRPC C++的源代码构建gRPC c++
我已经安装了 bazel。 虽然当我尝试构建时,我看到以下错误。
$ bazel build :all
Starting local Bazel server and connecting to it...
ERROR: /home/bigz/.cache/bazel/_bazel_bigz/a68d37101a3d172c639dd67a1941f719/external/io_bazel_rules_python/python/pip.bzl:39:25: Traceback (most recent
call last):
File "/home/bigz/.cache/bazel/_bazel_bigz/a68d37101a3d172c639dd67a1941f719/external/io_bazel_rules_python/python/pip.bzl", line 37
repository_rule(<2 more arguments>)
File "/home/bigz/.cache/bazel/_bazel_bigz/a68d37101a3d172c639dd67a1941f719/external/io_bazel_rules_python/python/pip.bzl", line 39, in repositor
y_rule
attr.label(allow_files = True, <2 more arguments>)
'single_file' is no longer supported. use allow_single_file instead. You can use --incompatible_disable_deprecated_attr_params=false to temporarily disable th
is check.
ERROR: error loading package '': Extension file 'python/pip.bzl' has errors
ERROR: error loading package '': Extension file 'python/pip.bzl' has errors
INFO: Elapsed time: 7.505s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
有人可以指出我在这里缺少什么。
当我尝试运行bazel info
时,我收到以下错误。
$ bazel info --incompatible_disable_deprecated_attr_params=false
ERROR: /home/bigz/.cache/bazel/_bazel_bigz/a68d37101a3d172c639dd67a1941f719/external/org_pubref_rules_protobuf/protobuf/internal/proto_compile.bzl:771:21: name 'FileType' is not defined
ERROR: error loading package '': in /home/bigz/.cache/bazel/_bazel_bigz/a68d37101a3d172c639dd67a1941f719/external/org_pubref_rules_protobuf/python/rules.bzl: in /home/bigz/.cache/bazel/_bazel_bigz/a68d37101a3d172c639dd67a1941f719/external/org_pubref_rules_protobuf/cpp/rules.bzl: in /home/bigz/.cache/bazel/_bazel_bigz/a68d37101a3d172c639dd67a1941f719/external/org_pubref_rules_protobuf/protobuf/rules.bzl: Extension 'protobuf/internal/proto_compile.bzl' has errors
虽然bazel --version
显示为bazel 2.0.0
.
$ bazel --version
bazel 2.0.0
gRPC 的最新提交是9dfbd34f5c0b20bd77658c73c59b9a3e4e8f4e14
$ git log -1
commit 9dfbd34f5c0b20bd77658c73c59b9a3e4e8f4e14 (HEAD, tag: v1.20.0)
Merge: 1b488f8361 ae72bf76b3
Author: Lidi Zheng <scallopsky@gmail.com>
Date: Mon Apr 15 15:38:24 2019 -0700
Merge pull request #18760 from lidizheng/v1.20.x
Bump version to v1.20.0
您尝试构建的 grpc 提交与您已安装的 bazel 版本(2.0.0( 不兼容。
提交9dfbd34f5c0b20bd77658c73c59b9a3e4e8f4e14
很旧(19 年 4 月 15 日(,该存储库的 HEAD(在撰写本文时(位于eba60d8dbe4099c34b8097b2c89998d4484740ac
,现在在 BUILDING.md 中表明您至少需要版本 1.0.0(tools/bazel
有一个 bazel 包装器,无论如何都会拦截并使用 1.0.0(
但是,对于您的特定提交,尝试不同的版本,我能够使用 bazel 版本 0.20.0 构建:all
标签
我建议尝试巴兹利斯克。您可以将其添加到您的 PATH 中,将.bazelversion
文件添加到存储库,bazelisk 将负责下载所需的 bazel 版本。
相关文章:
- 如何使用CMake编译.proto文件来生成.grpcp.pb.cc和.grpc.pb.h文件
- 我的项目不会像"undefined reference to `grpc::g_core_codegen_interface'"那样使用未定义的引用错误进行编译
- 在C++中使用 gRPC 时未解析的外部符号
- 如何绑定 C++ gRPC 客户端的网络接口
- gRPC 生成的代码缺少服务实现
- GRPC C++ TLS 客户端 grpc::SslCredentials() 方法不返回
- 预构建 grpc 和find_package
- 空 grpc 客户端通道
- 在 C++ 中修改 Grpc 双向流式处理期间的元数据
- 从源代码构建 gRPC C++
- grpc 的 ServerBuilder::AddListeningPort() 总是返回 TCP 端口零
- gRPC 找不到 Protobuf 库
- 如何从函数返回 grpc::ClientContext?
- 在 Linux 上使用 CMake 构建 gRPC C++
- C++ gRPC 线程编号配置
- 使用cmake交叉编译gRPC
- 构建使用协议缓冲区(不含 APK)的 Android 可执行 gRPC 服务器
- 客户端 gRPC 连接,C++重新连接?
- gRPC C++我设置截止时间时客户端阻止
- 如何动态链接 grpc 库 c++?