ZBLOG

在mac上水用bazel编译envoy报错,thread-local storage is not supported for the current target

这个报错是因为 macOS 系统不支持 thread-local storage,而 Bazel 在编译时需要使用该功能。解决方法如下:

1.升级你的 macOS 版本到最新版本。

2.使用 Docker 环境运行 Bazel 编译 Envoy。在 Docker 中,可以使用 Linux 系统进行编译,从而避免 macOS 不支持的问题。具体步骤可以参考官方文档 https://www.envoyproxy.io/docs/envoy/latest/start/building.html#building-with-docker

3.修改编译选项,禁用 thread-local storage。在 Envoy 的 BUILD 文件中,找到 cc_library 相关的规则,加上 --copt=-fno-threadsafe-statics 选项,例如:

cc_library(
    name = "envoy_common",
    srcs = [
        ...
    ],
    hdrs = [
        ...
    ],
    visibility = ["//visibility:public"],
    deps = [
        ...
    ],
    copts = [
        "-fPIC",
        "-std=c++14",
        "-Wall",
        "-Werror",
        "--copt=-fno-threadsafe-statics", # 添加这一行
    ],
)

注意,这种方法可能会导致一些功能失效或出现其他问题,仅在无法使用其他方法时才考虑使用。

本站部分文章来源于网络,版权归原作者所有,如有侵权请联系站长删除。
转载请注明出处:https://golang.0voice.com/?id=1561

分享:
扫描分享到社交APP
上一篇
下一篇
发表列表
游客 游客
此处应有掌声~
评论列表

还没有评论,快来说点什么吧~

联系我们

在线咨询: 点击这里给我发消息

微信号:3007537140

上班时间: 10:30-22:30

关注我们
x

注册

已经有帐号?