From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4A1F4A051C; Tue, 11 Feb 2020 12:29:58 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 31E262BF4; Tue, 11 Feb 2020 12:29:58 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 2591C2BE9 for ; Tue, 11 Feb 2020 12:29:56 +0100 (CET) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Feb 2020 03:29:56 -0800 X-IronPort-AV: E=Sophos;i="5.70,428,1574150400"; d="scan'208";a="221904732" Received: from bricha3-mobl.ger.corp.intel.com ([10.237.221.79]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 11 Feb 2020 03:29:54 -0800 Date: Tue, 11 Feb 2020 11:29:51 +0000 From: Bruce Richardson To: Thomas Monjalon Cc: dev@dpdk.org, Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko Message-ID: <20200211112951.GA823@bricha3-MOBL.ger.corp.intel.com> References: <20200127154402.4008069-1-thomas@monjalon.net> <20200211011942.1569573-1-thomas@monjalon.net> <20200211011942.1569573-4-thomas@monjalon.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200211011942.1569573-4-thomas@monjalon.net> User-Agent: Mutt/1.12.1 (2019-06-15) Subject: Re: [dpdk-dev] [PATCH v3 3/5] net/mlx: workaround static linkage with meson X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Tue, Feb 11, 2020 at 02:19:40AM +0100, Thomas Monjalon wrote: > If ibverbs_link is static and the application choose to link DPDK > as static libraries, both PMD and ibverbs libraries must be linked > as static libraries. And the dependencies of ibverbs (netlink) must > still be linked as shared libraries. > > Unfortunately, meson forget about the static requirement for ibverbs > when generating the .pc file. > As a result, libibverbs, libmlx4, libmlx5 are listed in Requires.private > section (allowing to be linked as shared libraries) and libnl is missing. > > A fix is in progress for meson, but anyway we will have to live without > such a fix until a better version of meson is widely available: > https://github.com/mesonbuild/meson/pull/6393 > > In order to avoid meson suggesting shared libraries in the section > Requires.private of the .pc file, the dependency object is recreated > with declare_dependency(): > - cflags are extracted the libibverbs.pc > - ldflags, from libibverbs.pc, are processed to force > static flavor of ibverbs libraries, thanks to this syntax: > -l:libfoo.a > > Fixes: 83fff714bd27 ("net/mlx: add static ibverbs linkage with meson") > > Signed-off-by: Thomas Monjalon > Signed-off-by: Bruce Richardson > --- > buildtools/meson.build | 2 ++ > drivers/common/mlx5/meson.build | 12 +++++++++++- > drivers/net/mlx4/meson.build | 14 ++++++++++++-- > 3 files changed, 25 insertions(+), 3 deletions(-) > > diff --git a/buildtools/meson.build b/buildtools/meson.build > index 0f563d89a3..4e3541b0d7 100644 > --- a/buildtools/meson.build > +++ b/buildtools/meson.build > @@ -3,9 +3,11 @@ > > subdir('pmdinfogen') > > +pkgconf = find_program('pkg-config', 'pkgconf') > pmdinfo = find_program('gen-pmdinfo-cfile.sh') > list_dir_globs = find_program('list-dir-globs.py') > check_experimental_syms = find_program('check-experimental-syms.sh') > +ldflags_ibverbs_static = find_program('options-ibverbs-static.sh') > > # set up map-to-def script using python, either built-in or external > python3 = import('python').find_installation(required: false) > diff --git a/drivers/common/mlx5/meson.build b/drivers/common/mlx5/meson.build > index f24e421bc3..bf04d16d76 100644 > --- a/drivers/common/mlx5/meson.build > +++ b/drivers/common/mlx5/meson.build > @@ -30,16 +30,26 @@ foreach libname:libnames > endif > if lib.found() > libs += lib > + if not static_ibverbs > + ext_deps += lib > + endif > else > build = false > reason = 'missing dependency, "' + libname + '"' > endif > endforeach > +if build and static_ibverbs > + # Build without adding shared libs to Requires.private > + ibv_cflags = run_command(pkgconf, '--cflags', 'libibverbs').stdout() > + ext_deps += declare_dependency(compile_args: ibv_cflags.split()) > + # Add static deps ldflags to internal apps and Libs.private > + ibv_ldflags = run_command(ldflags_ibverbs_static, check:true).stdout() > + ext_deps += declare_dependency(link_args:ibv_ldflags.split()) > +endif > Is there a reason for specfiying two dependencies, rather than putting both cflags and ldflags into the one dependency object?