有关使用bazel编译protobuf,可参考这里
发现编译过程中发生错误
ERROR: /home/wcx/.cache/bazel/_bazel_wcx/66285bf64a1e5161222b89f7094b2f2f/external/com_google_protobuf/BUILD:1006:21: in proto_lang_toolchain rule @com_google_protobuf//:cc_toolchain: '@com_google_protobuf//:cc_toolchain' does not have mandatory provider 'ProtoInfo'.
ERROR: Analysis of target '//:write' failed; build aborted: Analysis of target '@com_google_protobuf//:cc_toolchain' failed
INFO: Elapsed time: 3.616s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (18 packages loaded, 557 targets configu\
red)
解决方法
在WORKSPACE
文件中添加以下内容:
# cat WORKSPACE
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "com_google_protobuf",
strip_prefix = "protobuf-3.11.3",
urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.11.3.tar.gz"],
patches = ["//:protobuf_protoinfo_prepare.patch", "//:protobuf_protoinfo_apply.patch"],
)
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
protobuf_deps()
参考
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)