DPDK usage discussions
 help / color / mirror / Atom feed
* [dpdk-users] DPDK library link issue with __attribute__((constructor))
@ 2018-03-05  5:08 Hui Liu
  2018-03-05  9:15 ` Hui Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Hui Liu @ 2018-03-05  5:08 UTC (permalink / raw)
  To: users

Hi Guys,

I am using DPDK with the yocto build system.

I found some static library is not linked because of the linker's as-needed
decision.

Some .a file use __attribute__((constructor)) to register their APIs,
we only know if we use these APIs at runtime, but linker make the decision
early and then discarded them.

I tried a lot to link the library I need:

1, use -Wl, --no-as-needed, for example:
gcc a.c *-Wl, --no-as-needed* -ldl -ldpdk

2, Put the library explicitly to the linker like this:
gcc a.c -Wl, --no-as-needed -ldl -ldpdk *-lrte_mempool*

At last, I still didn't find my library in the elf file.

Is there anything else I can try to link these library?

-- 
Thanks & Best Regards
Liu Hui
--

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-03-07  1:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-05  5:08 [dpdk-users] DPDK library link issue with __attribute__((constructor)) Hui Liu
2018-03-05  9:15 ` Hui Liu
2018-03-05 13:28   ` Wiles, Keith
2018-03-07  1:02     ` Hui Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).