无法使用bazel建立项目。没有方法new_http_archive()

时间:2019-11-18 23:52:23

标签: grpc bazel

我尝试使用bazel构建github项目(grpc),但遇到此错误。似乎由于某种原因该方法不在我的环境中。但是我不确定为什么要使用最新的挡板。

Bazel build:all 警告:以下rc文件将不再被读取,请转移其内容或将其路径导入标准rc文件之一: /usr/local/google/home/ajamato/grpc/tools/bazel.rc INFO:将跟踪器配置文件写入

'/usr/local/google/home/ajamato/.cache/bazel/_bazel_ajamato/7d9cb851a3ed2d28aac44248d4b651f6/command.profile.gz'
ERROR: /usr/local/google/home/ajamato/grpc/WORKSPACE:4:1: Traceback (most recent call last):
        File "/usr/local/google/home/ajamato/grpc/WORKSPACE", line 4
                grpc_deps()
        File "/usr/local/google/home/ajamato/grpc/bazel/grpc_deps.bzl", line 112, in grpc_deps
                native.http_archive(name = "boringssl", url = "https:/...")
type 'struct' has no method http_archive()
ERROR: /usr/local/google/home/ajamato/grpc/WORKSPACE:5:1: Traceback (most recent call last):
        File "/usr/local/google/home/ajamato/grpc/WORKSPACE", line 5
                grpc_test_only_deps()
        File "/usr/local/google/home/ajamato/grpc/bazel/grpc_deps.bzl", line 213, in grpc_test_only_deps
                native.new_http_archive(name = "com_github_twisted_twist...", <3 more arguments>)
type 'struct' has no method new_http_archive()
ERROR: Error evaluating WORKSPACE file
ERROR: Skipping ':all': while parsing ':all': error loading package 'external': Package 'external' contains errors
WARNING: Target pattern parsing failed.
ERROR: while parsing ':all': error loading package 'external': Package 'external' contains errors
INFO: Elapsed time: 0.063s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)

有关我的环境的一些信息。

ajamato@ajamato-linux0:~/grpc$ bazel --version
bazel 1.0.1
ajamato@ajamato-linux0:~/grpc$ python --version
Python 2.7.17rc1
ajamato@ajamato-linux0:~/grpc$ python3 --version
Python 3.7.5rc1

1 个答案:

答案 0 :(得分:1)

原始版本new_http_archive已从2月份发布的bazel版本0.23.0中删除。您使用的是grpc的旧版本吗?尝试使用更新的grpc版本,该版本似乎正在使用new_http_archive的替代版本: https://github.com/grpc/grpc/blob/a711d404cc0a9d7ecb286d37302bc7a8ff25062e/bazel/grpc_deps.bzl#L3