在GCC中链接包含循环引用的库 [英] Linking Libraries that contain circular references in GCC
问题描述
有两个库会导致问题。 Libsupport为应用程序提供了一个终端。它依靠libcpu提供串行链接,定时和同步。 Libcpu依靠libsupport为串行数据提供排队等等。
如果我先指定libsupport,则链接libcpu无法与队列函数链接。我指定libcpu首先lib支持不能链接串行链接(和更多)函数。
它看起来像GCC只解析一次库并丢弃任何未使用的对象。 / p>
我可以让gcc多次解析库或包含所有对象吗?
gcc ... -lsupport -lcpu -lsupport -lcpu
- >每提到一个库,都会导致解析库之前的库(但不一定是之后指定的库),这就是为什么您将来可能需要指定更多-lsupport -lcpu。
或者,尝试 - start-group -lsupport - lcpu --end-group
一次。
I am trying to link an application with multiple static libraries in GCC.
There are two libraries that cause problems. Libsupport provides a terminal for the application. It relies on libcpu to provide a serial link, timing and syncronisation. Libcpu relies on libsupport to provide queueing for serial data and more.
If I specify libsupport first when linking libcpu cannot be linked with the queue functions. Is I specify libcpu first lib support can not link the serial link (and more) functions.
It looks like GCC parses a library only once and discard any unused objects.
Can I ask gcc to parse libraries multiple times or to include all objects?
gcc ... -lsupport -lcpu -lsupport -lcpu
-> Each mention of a library will cause resolution of libraries that came before it (but not necessarily ones specified afterwards), which is why you may need to specify more "-lsupport -lcpu" in future.
Alternatively, try --start-group -lsupport -lcpu --end-group
once.
这篇关于在GCC中链接包含循环引用的库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!