[dpdk-dev] building shared library

Chi, Xiaobo (NSN - CN/Hangzhou) xiaobo.chi at nsn.com
Tue Nov 11 04:28:26 CET 2014


Hi,
I am using DPDK based shared lib, but never met such problems. Can you please share this the result of "ldd xxxxx.so" and check if all those depended lib are all avalible? 

brgs,
chi xiaobo

-----Original Message-----
From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of ext Newman Poborsky
Sent: Monday, November 10, 2014 10:23 PM
To: dev at dpdk.org
Subject: [dpdk-dev] building shared library

Hi,

is it possible to build a  dpdk app as a shared library?

I tried to put 'include $(RTE_SDK)/mk/rte.extshared.mk' in my Makefile (and
define SHARED) and it builds .so lib, but all rte_* symbols are undefined.

After that i tried adding:
LDLIBS += -lrte_eal -lrte_mbuf -lrte_cmdline -lrte_timer  -lrte_mempool
-lrte_ring  -lrte_pmd_ring -lethdev -lrte_malloc

And now almost all symbols in .so file are defined (missing only
rte_hexdump).

I thought this was gonna be it. But after using this library, pci probe-ing
fails since I don't have any pmd drivers registered, and
rte_eth_dev_count() returns 0.

But how are drivers supposed to be registered?

When I use gdb with regular dpdk app (not shared library), I can see this:
#0  0x000000000046fab0 in rte_eal_driver_register ()
#1  0x0000000000418fb7 in devinitfn_bond_drv ()
#2  0x00000000004f15ed in __libc_csu_init ()
#3  0x00007ffff6efee55 in __libc_start_main (main=0x41ee65 <main>, argc=1,
argv=0x7fffffffe4f8, init=0x4f15a0 <__libc_csu_init>, fini=<optimized out>,
rtld_fini=<optimized out>, stack_end=0x7fffffffe4e8) at
libc-start.c:246
#4  0x000000000041953c in _start ()


Ok, if I'm not mistaken, it seems driver registration is called before
main. How is this accomplished? Cause in shared library build, I don't have
this before main() and after rte_eal_init() (since driver list is empty)
everything else fails.

Any suggestions please? I'd really appreciate it...

BR,
Newman P.


More information about the dev mailing list