Message ID | 1449249063-9792-1-git-send-email-david.marchand@6wind.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 1810F8EA0; Fri, 4 Dec 2015 18:11:31 +0100 (CET) Received: from mail-wm0-f49.google.com (mail-wm0-f49.google.com [74.125.82.49]) by dpdk.org (Postfix) with ESMTP id 08F7D8E9E for <dev@dpdk.org>; Fri, 4 Dec 2015 18:11:30 +0100 (CET) Received: by wmww144 with SMTP id w144so70209594wmw.1 for <dev@dpdk.org>; Fri, 04 Dec 2015 09:11:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=y9qW7shDY96xWbUu5/IH9TgElM8Vcjh2ltpFKe8PzAs=; b=M7mvy4Snwb8rAlCdWVtU3C0dppk8is0RVbcVK0DQ8EvcVVWbtJAmjDS5sIQRt8Z4v/ Hxq8cCWGySAJxaiXuNJG/8MopUA850+9/xisZrFxR1rQH8exROsroi8ACYWb63MgguLp w+5WM+/7BY5Sj2JEm9luYY9+tcL99vJp1CuM38LYovp09oKmgneqbZqybav2BNk91m+4 g4duIQBRwLw4Mb5G2o+yaHalS1907GY1NIEcs4q69Nc5qQUqW3CLK0UJ3+gxF5oEhO6v OEXraCPdqYAdpI+vt0adFMjE0nwVOjsXmboNOitFuqM16mY7aHLtT4SWRMVFcCDHAGFv 7CwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=y9qW7shDY96xWbUu5/IH9TgElM8Vcjh2ltpFKe8PzAs=; b=K6DJL0noURwcUvu2d/f1RX/DlwOMaSTQptNyEuusi89/e1yT+hIlq+27vzni76E6G2 UxA/1BnCoLZeQ+XSuQPFvxw4aG8I0ovaGk0U5xDWc0gFoNHoCp7Q1/kRitMVlLifss70 rz1njLWZSt5wjwLLUE8LsvNHp9Z7izmpN6LbrGWvccUiUL1lBwc8CjXOw/8UrsexpRAN wdQRsNCuIU7O1u4S8KCaUEVxoKSjHDnfpAD/7cCpZhWnupSNu4hd8/IKXE1urXldtP4f vdaoZhmoprZJbJGeh+XQCRnjr5t9PX6DJX/2/uSsUTJdMl2iS+xJj9hpyI69Ey2mMiEn nnpQ== X-Gm-Message-State: ALoCoQn+XTDWLT9xt7zMZvu7HJ8ErWSY2YtsqljHxuCf4jf3i6wipO5YSyi3bFIh4zEAMDW8VSM3 X-Received: by 10.194.133.233 with SMTP id pf9mr18717706wjb.71.1449249089844; Fri, 04 Dec 2015 09:11:29 -0800 (PST) Received: from alcyon.dev.6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id e83sm4300830wmc.23.2015.12.04.09.11.28 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 04 Dec 2015 09:11:29 -0800 (PST) From: David Marchand <david.marchand@6wind.com> To: dev@dpdk.org Date: Fri, 4 Dec 2015 18:11:03 +0100 Message-Id: <1449249063-9792-1-git-send-email-david.marchand@6wind.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1449239893-4012-1-git-send-email-david.marchand@6wind.com> References: <1449239893-4012-1-git-send-email-david.marchand@6wind.com> Subject: [dpdk-dev] [PATCH v2] mk: fix objects/library order when linking X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
David Marchand
Dec. 4, 2015, 5:11 p.m. UTC
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 <david.marchand@6wind.com>
---
Changes since v1:
- added some details in commitlog since Thomas does not like "safer"
argument :-)
---
mk/rte.lib.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
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 <david.marchand@6wind.com> > --- > > Changes since v1: > - added some details in commitlog since Thomas does not like "safer" > argument :-) Obvious issue that did not show up in our tests under Debian. Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
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 <david.marchand@6wind.com> > > --- > > > > 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 <adrien.mazarguil@6wind.com> Applied, thanks
diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk index 06a1519..1f1b6e1 100644 --- a/mk/rte.lib.mk +++ b/mk/rte.lib.mk @@ -82,7 +82,7 @@ O_TO_A_DO = @set -e; \ $(O_TO_A) && \ echo $(O_TO_A_CMD) > $(call exe2cmd,$(@)) -O_TO_S = $(LD) $(_CPU_LDFLAGS) $(EXTRA_LDFLAGS) $(LDLIBS) -shared $(OBJS-y) \ +O_TO_S = $(LD) $(_CPU_LDFLAGS) $(EXTRA_LDFLAGS) -shared $(OBJS-y) $(LDLIBS) \ -Wl,-soname,$(LIB) -o $(LIB) O_TO_S_STR = $(subst ','\'',$(O_TO_S)) #'# fix syntax highlight O_TO_S_DISP = $(if $(V),"$(O_TO_S_STR)"," LD $(@)")