How to link a library build using make rule in bazel

六月ゝ 毕业季﹏ 提交于 2019-12-24 00:46:16

问题


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?


回答1:


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 = ["...", "..."],
)

See the documentation on C++ use cases for more information.



来源:https://stackoverflow.com/questions/58329033/how-to-link-a-library-build-using-make-rule-in-bazel

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!