如何在bazel中使用make规则链接库构建 [英] How to link a library build using make rule in bazel
问题描述
我已经使用在bazel中创建规则来构建lib.so .如何将此外部lib.so链接到常规cc_library规则.我尝试将其添加到deps中,但是指南建议deps可以具有cc_library或objc_library目标.
I have built a lib.so using make rule in bazel. How do I link this external lib.so to a regular cc_library rule. I tried adding it in deps, but the guide suggests that deps can have cc_library or objc_library targets.
此外,我是否需要传递任何特定的链接选项,我如何阅读有关它们的更多信息?
Also, do I need to pass any specific linking options, and how can I read more about them?
推荐答案
在BUILD文件中,创建一个cc_library
目标,该目标将导入的已构建lib.so
导入其他要依赖的cc_library
目标:
In the BUILD file, create a cc_library
target that imports the built lib.so
for other cc_library
targets to depend on:
cc_library(
name = "lib",
srcs = ["lib.so"],
linkopts = ["...", "..."],
)
请参见文档有关C ++用例的更多信息.
See the documentation on C++ use cases for more information.
这篇关于如何在bazel中使用make规则链接库构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!