[dpdk-stable] [PATCH 3/6] net/mlx: fix library search in meson build

Luca Boccassi bluca at debian.org
Thu Apr 18 11:25:19 CEST 2019


On Mon, 2019-04-15 at 19:48 +0000, Yongseok Koh wrote:
> Hi,
> 
> 
> 
> Thanks,
> Yongseok
> 
> > On Apr 15, 2019, at 3:12 AM, Luca Boccassi <
> > bluca at debian.org
> > > wrote:
> > 
> > On Fri, 2019-04-12 at 16:24 -0700, Yongseok Koh wrote:
> > > If MLNX_OFED is installed, there's no .pc file installed for
> > > libraries and
> > > dependency() can't find libraries by pkg-config. By adding
> > > fallback
> > > of
> > > using cc.find_library(), libraries are properly located.
> > > 
> > > Fixes: e30b4e566f47 ("build: improve dependency handling")
> > > Cc: 
> > > bluca at debian.org
> > > 
> > > 
> > > Cc: 
> > > stable at dpdk.org
> > > 
> > > 
> > > 
> > > Signed-off-by: Yongseok Koh <
> > > yskoh at mellanox.com
> > > 
> > > 
> > > ---
> > > drivers/net/mlx4/meson.build | 19 +++++++++++--------
> > > drivers/net/mlx5/meson.build | 19 +++++++++++--------
> > > 2 files changed, 22 insertions(+), 16 deletions(-)
> > > 
> > > diff --git a/drivers/net/mlx4/meson.build
> > > b/drivers/net/mlx4/meson.build
> > > index de020701d1..9082f69f25 100644
> > > --- a/drivers/net/mlx4/meson.build
> > > +++ b/drivers/net/mlx4/meson.build
> > > @@ -13,21 +13,24 @@ if pmd_dlopen
> > > 		'-DMLX4_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
> > > 	]
> > > endif
> > > -libs = [
> > > -	dependency('libmnl', required:false),
> > > -	dependency('libmlx4', required:false),
> > > -	dependency('libibverbs', required:false),
> > > -]
> > > +libs = [ 'libmnl', 'libmlx4', 'libibverbs' ]
> > > +lib_deps = []
> > > build = true
> > > foreach lib:libs
> > > -	if not lib.found()
> > > +	lib_dep = dependency(lib, required:false)
> > > +	if not lib_dep.found()
> > > +		lib_dep = cc.find_library(lib, required:false)
> > 
> > Doesn't this end up trying to link the test program to -llibmnl and
> > thus failing?
> 
> I also worried about that. But it works fine.
> Looks meson is smart enough. :-)

Sorry, not to be skeptical, but at least with the meson version I was
using when doing something similar I'm sure this didn't work -
find_library just takes the parameter, adds "-l" in front of it and
uses it to compile.

In the meson configure log, do you see:

Dependency libmlx4 found: NO
Library libmlx4 found: YES

?

-- 
Kind regards,
Luca Boccassi


More information about the stable mailing list