Alex Amato
Alex Amato

Reputation: 1725

Unable to builld project with bazel. no method new_http_archive()

I tried building a github project (grpc) with bazel, but got this error. It seems like perhaps this method is not in my environment for some reason. But I am not sure why as I am using the latest bazel.

bazel build :all WARNING: The following rc files are no longer being read, please transfer their contents or import their path into one of the standard rc files: /usr/local/google/home/ajamato/grpc/tools/bazel.rc INFO: Writing tracer profile to

'/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)

Some info about my environment.

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

Upvotes: 2

Views: 591

Answers (1)

ahumesky
ahumesky

Reputation: 5006

The native version of new_http_archive was removed in bazel version 0.23.0, which was released back in February. Are you using an older version of grpc? Try using a newer version of grpc, which appears to be using the replacement for new_http_archive: https://github.com/grpc/grpc/blob/a711d404cc0a9d7ecb286d37302bc7a8ff25062e/bazel/grpc_deps.bzl#L3

Upvotes: 2

Related Questions