[dpdk-dev] [PATCH v2] mk: fix objects/library order when linking

Adrien Mazarguil adrien.mazarguil at 6wind.com
Fri Dec 4 18:31:14 CET 2015


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 at 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 at 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 at 6wind.com>

-- 
Adrien Mazarguil
6WIND


More information about the dev mailing list