From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v2] mk: fix objects/library order when linking Date: Fri, 04 Dec 2015 19:43:30 +0100 Message-ID: <2454571.EZpaR9m7WP@xps13> References: <1449239893-4012-1-git-send-email-david.marchand@6wind.com> <1449249063-9792-1-git-send-email-david.marchand@6wind.com> <20151204173114.GH5048@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org To: David Marchand Return-path: Received: from mail-wm0-f47.google.com (mail-wm0-f47.google.com [74.125.82.47]) by dpdk.org (Postfix) with ESMTP id BE72C9221 for ; Fri, 4 Dec 2015 19:44:40 +0100 (CET) Received: by wmww144 with SMTP id w144so76378643wmw.0 for ; Fri, 04 Dec 2015 10:44:40 -0800 (PST) In-Reply-To: <20151204173114.GH5048@6wind.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 2015-12-04 18:31, Adrien Mazarguil: > On Fri, Dec 04, 2015 at 06:11:03PM +0100, David Marchand wrote: > > The initial problem has been seen while building mlx4 pmd as a shared library > > on Ubuntu 14.04 (gcc 4.8.4-2ubuntu1~14.04). > > > > Resulting .so will lack the DT_NEEDED entry for libibverbs: > > > > marchand@ubuntu1404:~/dpdk$ ldd ./build/lib/librte_pmd_mlx4.so > > linux-vdso.so.1 => (0x00007fff87ebb000) > > libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2ced21a000) > > /lib64/ld-linux-x86-64.so.2 (0x00007f2ced821000) > > > > And trying to load it in testpmd triggers this error: > > > > [...] > > EAL: librte_pmd_mlx4.so: undefined symbol: ibv_query_port > > [...] > > > > After some strace, the problem comes from the --as-needed option passed to the > > linker. > > > > It is safer to specify libraries we depend on after the objects we are linking > > into a shared library, especially when the linker is invoked with options like > > --as-needed. > > > > Fixes: bef06a8a0655 ("mk: set library dependencies in shared object file") > > > > Signed-off-by: David Marchand > > --- > > > > Changes since v1: > > - added some details in commitlog since Thomas does not like "safer" > > argument :-) Yes, that's better justified with these details :) > Obvious issue that did not show up in our tests under Debian. > > Acked-by: Adrien Mazarguil Applied, thanks