From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com [209.85.217.178]) by dpdk.org (Postfix) with ESMTP id EE94A5901 for ; Tue, 11 Nov 2014 08:19:19 +0100 (CET) Received: by mail-lb0-f178.google.com with SMTP id f15so7905803lbj.37 for ; Mon, 10 Nov 2014 23:29:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=rDDRLwGI9O63iRveYzpqe00eL0Tg8q6CWCpJkVyhqiI=; b=dd9FsQPyoOnji+KZ+JMCNAM3Ru6rrFTUWdD/P/1IOQWnRrJ18NUaxCPtyiuYAPitZB 61CAYRADJI40N58/J6+3CaRDwKnCWgk7g7giEBOKav6MMjaNOGI8/jXsXsc8XJXCfqBR 9yBcwfO2ukYbHChtX6X2+Rd4ngCEmxO00kEqG7kn7GV40XfeKgsyPKyzcK/mM0xsLCVU DiltIHzKqNwri81FTWaLwVtO3bm8pIisgbbIk9Ow1Rfjxmt+S5e86N8AR6+mThFpoyDS cBFe0NSo5aQyin8JXTJnfJo3JQAPWZpTjSq69zgzGBadKXlGToR/AA9XI8Th2zl0fIBk kcJQ== MIME-Version: 1.0 X-Received: by 10.112.151.70 with SMTP id uo6mr34136203lbb.2.1415690948477; Mon, 10 Nov 2014 23:29:08 -0800 (PST) Received: by 10.25.216.158 with HTTP; Mon, 10 Nov 2014 23:29:08 -0800 (PST) In-Reply-To: References: Date: Tue, 11 Nov 2014 08:29:08 +0100 Message-ID: From: Newman Poborsky To: "Chi, Xiaobo (NSN - CN/Hangzhou)" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] building shared library X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Nov 2014 07:19:20 -0000 Hi, sure, here it is: ldd libdpdk-api.so linux-vdso.so.1 => (0x00007fff3fffe000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f583dd99000) /lib64/ld-linux-x86-64.so.2 (0x00007f583e5d4000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f583db7a000) This is a library built with Makefile that has the following options: RTE_BUILD_SHARED_LIB=y CFLAGS += -fPIC LDLIBS += -lrte_eal -lrte_mbuf -lrte_cmdline -lrte_timer -lrte_mempool -lrte_ring -lrte_pmd_ring -lethdev -lrte_malloc include $(RTE_SDK)/mk/rte.extshared.mk There are no missing libraries. I also had to add '-fPIC' flag to all Makefiles of lrte_* libs above. Is this the correct way to build shared lib? Am I missing something? When I build it as a regular dpdk app (like helloworld example) ldd output is this: ldd dpdk-api linux-vdso.so.1 => (0x00007fffacbfe000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ffe91b2b000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007ffe91922000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ffe9171e000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ffe91139000) /lib64/ld-linux-x86-64.so.2 (0x00007ffe92042000) libpcap.so.1 => /usr/local/lib/libpcap.so.1 (0x00007ffe90ef8000) Thank you for any help! BR, Newman P. On Tue, Nov 11, 2014 at 4:28 AM, Chi, Xiaobo (NSN - CN/Hangzhou) < xiaobo.chi@nsn.com> wrote: > 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@dpdk.org] On Behalf Of ext Newman Poborsky > Sent: Monday, November 10, 2014 10:23 PM > To: dev@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
, argc=1, > argv=0x7fffffffe4f8, init=0x4f15a0 <__libc_csu_init>, fini=, > rtld_fini=, 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. >