From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 7B71AA051C;
	Tue, 11 Feb 2020 12:43:12 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 6063A1C06D;
	Tue, 11 Feb 2020 12:43:12 +0100 (CET)
Received: from mga18.intel.com (mga18.intel.com [134.134.136.126])
 by dpdk.org (Postfix) with ESMTP id 44B4A1C012
 for <dev@dpdk.org>; Tue, 11 Feb 2020 12:43:11 +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 orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 11 Feb 2020 03:43:10 -0800
X-IronPort-AV: E=Sophos;i="5.70,428,1574150400"; d="scan'208";a="221906962"
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:43:08 -0800
Date: Tue, 11 Feb 2020 11:43:05 +0000
From: Bruce Richardson <bruce.richardson@intel.com>
To: Thomas Monjalon <thomas@monjalon.net>
Cc: dev@dpdk.org, Matan Azrad <matan@mellanox.com>,
 Shahaf Shuler <shahafs@mellanox.com>,
 Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Message-ID: <20200211114305.GE823@bricha3-MOBL.ger.corp.intel.com>
References: <20200127154402.4008069-1-thomas@monjalon.net>
 <20200211011942.1569573-4-thomas@monjalon.net>
 <20200211112951.GA823@bricha3-MOBL.ger.corp.intel.com>
 <10758925.RiKt1P0BV1@xps>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <10758925.RiKt1P0BV1@xps>
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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

On Tue, Feb 11, 2020 at 12:36:06PM +0100, Thomas Monjalon wrote:
> 11/02/2020 12:29, Bruce Richardson:
> > 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 <thomas@monjalon.net>
> > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > > ---
> > > +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?
> 
> Yes, the reason is the patch for dlopen which needs cflags only.
> 
Ah, ok, thanks for clarifying.