【发布时间】:2018-01-05 05:54:17
【问题描述】:
我正在使用 bazel 构建一个带有 gRPC 库的程序。我的工作空间文件:
http_archive(
name = "com_github_grpc_grpc",
urls = ["https://github.com/grpc/grpc/archive/v1.8.3.zip"],
sha256 = "57a2c67abe789ce9e80d49f473515c7479ae494e87dba84463b10bbd0990ad62",
strip_prefix = "grpc-1.8.3",
)
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
grpc_deps()
构建文件:
proto_library(
name = "test_proto",
srcs = ["test.proto"],
)
cc_proto_library(
name = "test_cc_proto",
deps = [":test_proto"],
)
cc_binary(
name = "hello",
srcs = ["hello.cc"],
deps = [
":test_cc_proto",
"@com_github_grpc_grpc//:grpc++",
],
)
编译这个会抛出错误:
every rule of type proto_library implicitly depends upon the target '@com_google_protobuf_cc//:cc_toolchain', but this target could not be found because of: no such package '@com_google_protobuf_cc//': The repository could not be resolved.
如果我手动包含 com_google_protobuf_cc 存储库,则版本不匹配,并且我收到错误消息说 test.pb.h 是使用较新版本的 protoc 生成的。
如何让 gRPC 加载正确版本的 com_google_protobuf_cc?
【问题讨论】:
标签: c++ protocol-buffers grpc bazel