gpt4 book ai didi

c++ - 从源代码构建gRPC C++

转载 作者:行者123 更新时间:2023-12-02 10:06:50 30 4
gpt4 key购买 nike

我正在尝试从Build 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(在这里有一个bazel包装器)仍然会拦截并使用1.0.0的tools/bazel)

但是,对于您的特定提交,尝试不同的版本,我能够使用Bazel版本0.20.0构建:all标签

我建议尝试bazelisk。您可以将其添加到PATH中,将.bazelversion文件添加到存储库中,而bazelisk将负责下载所需的bazel版本。

关于c++ - 从源代码构建gRPC C++,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59815586/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com