【问题标题】:Building the protobuf library as a static library将 protobuf 库构建为静态库
【发布时间】:2019-03-07 18:32:51
【问题描述】:

有没有一种优雅的方法可以使用 bazel 将 protobuf 库构建为静态库?

如果没有,那么是否有办法在 bazel 中构建并获取 so 的绝对路径以进行链接?

【问题讨论】:

    标签: build shared-libraries static-libraries bazel


    【解决方案1】:

    您可以使用linkstatic 选项将库构建为静态库。见:https://docs.bazel.build/versions/master/be/c-cpp.html#cc_library.linkstatic

    至于链接,您应该让 Bazel 通过将 Protobuf 库添加到 deps 列表来为您生成链接器标志。见:https://docs.bazel.build/versions/master/be/c-cpp.html#cc_library.deps

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-21
      • 1970-01-01
      • 2011-08-09
      • 1970-01-01
      • 1970-01-01
      • 2018-10-05
      相关资源
      最近更新 更多