bazel编译protobuf时 “ERROR: cc

bazel编译protobuf时 “ERROR: cc,第1张

有关使用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()

参考

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/996006.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-21
下一篇 2022-05-21

发表评论

登录后才能评论

评论列表(0条)

保存