3
如何在靜態模式(linkstatic = 1)下靜態鏈接系統庫?我嘗試使用「-Wl,-Bstatic -lboost_thread -Wl,-Bdynamic」或「-Wl,-Bstatic」,「-lboost_thread」,「-Wl,-Bdynamic」,但它們都不起作用。我不想在系統中硬編碼libboost_thread.a的路徑。如何在Bazel中靜態鏈接系統庫?
cc_binary(
name = "main",
srcs = [
"main.cpp",
],
linkopts = [
"-lboost_thread",
],
)
而boost_thread庫被鏈接爲一個動態庫。
ldd bazel-bin/main
linux-vdso.so.1
libboost_thread.so.1.54.0 => /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.54.0
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
...
什麼是工作區文件? –
boost_thread.BUILD應該位於何處? – tweej