我使用gn作为我的构建系统,我想用“-完整存档”来实现另一个目标,但我发现似乎没有办法这样做?
我需要的是:
clang++ -o libmy.so -Wl,--start-group libA.a libB.a -Wl,-whole-archive libC.a -Wl,-no-whole-archive -Wl,--end-group--end-group
谢谢
发布于 2022-02-06 15:32:56
GN似乎不支持此用例。但是,尝试将libC构建为source_set而不是static_library。
https://gn.googlesource.com/gn/+/master/docs/reference.md#func_source_set
A source set is a collection of sources that get compiled, but are not
linked to produce any kind of library. Instead, the resulting object files
are implicitly added to the linker line of all targets that depend on the
source set.将来自libC的每个对象文件直接放在链接线上与使用-Wl,--whole-archive具有相同的效果。
https://stackoverflow.com/questions/69496401
复制相似问题