From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lb0-f194.google.com (mail-lb0-f194.google.com [209.85.217.194]) by dpdk.org (Postfix) with ESMTP id EA0997E9D for ; Mon, 10 Nov 2014 15:12:55 +0100 (CET) Received: by mail-lb0-f194.google.com with SMTP id w7so1643793lbi.9 for ; Mon, 10 Nov 2014 06:22:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=HRSACKLNHZbINdWDRvzcDvkb107uG4WeFhHHjNPvVD0=; b=bwapz5gioMA4tWuFzY8NdQwLN0GMFzxbmIKR6o9Jv6DrYb/RrOHDdkkiyrWEKIOTtF jq4FUtnOpTvx7BfmTNKPJPP8bb19tNaBQwsvMks6mS/dbwk0kViWjWf5BOvaYpHE0HyR JCkr3/Tmxj9n+RS6kuTMQh7kem+YuSBUwS/duIeAIpEXzPGCTfqhNaeT9uDnUz3QJZGT AVWsUvHLj4cVkH7J+gCrmd94X2cRAbvagTVFCSSNtcNygvquoSvWkMv5j5qbpCmz8x8d ODK9UadZ1MeD/V0szJod1KBAeudp2s53AhJnihdddunvn/ZBw9KBPWtMM4XnAMuhroQ8 68Gg== MIME-Version: 1.0 X-Received: by 10.152.8.1 with SMTP id n1mr29315246laa.28.1415629361024; Mon, 10 Nov 2014 06:22:41 -0800 (PST) Received: by 10.25.216.158 with HTTP; Mon, 10 Nov 2014 06:22:40 -0800 (PST) Date: Mon, 10 Nov 2014 15:22:40 +0100 Message-ID: From: Newman Poborsky To: "dev@dpdk.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [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: Mon, 10 Nov 2014 14:12:56 -0000 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.