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 46C3FA0532; Tue, 4 Feb 2020 12:48:48 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9D1CE1C121; Tue, 4 Feb 2020 12:48:47 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id AB7D11BE8E for ; Tue, 4 Feb 2020 12:48:45 +0100 (CET) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Feb 2020 03:48:44 -0800 X-IronPort-AV: E=Sophos;i="5.70,401,1574150400"; d="scan'208";a="224270373" Received: from bricha3-mobl.ger.corp.intel.com ([10.237.221.79]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 04 Feb 2020 03:48:41 -0800 Date: Tue, 4 Feb 2020 11:48:38 +0000 From: Bruce Richardson To: Thomas Monjalon Cc: dev@dpdk.org Message-ID: <20200204114838.GC637@bricha3-MOBL.ger.corp.intel.com> References: <20200116071656.1663967-1-thomas@monjalon.net> <20200127154402.4008069-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200127154402.4008069-1-thomas@monjalon.net> User-Agent: Mutt/1.12.1 (2019-06-15) Subject: Re: [dpdk-dev] [PATCH v2 0/4] add static ibverbs in 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 Mon, Jan 27, 2020 at 04:43:58PM +0100, Thomas Monjalon wrote: > This is the follow-up of the feature I added one year ago: > static linkage of libibverbs in mlx PMDs. > The first implementation was focused on "make". > This second round does the same with "meson". > > > changes in v2: > - split mlx patch for normal addition and workarounds > - fix ldflags for ibverbs installed in a standard directory > - fix libs order leading to undefined references > - add doc for hidden_deps > - improve explanations in commit logs > > > Thomas Monjalon (4): > net/mlx: add static ibverbs linkage with meson > buildtools: get static mlx dependencies for meson > build: allow hiding dependencies from pkg-config > net/mlx: workaround static linkage with meson > > Hi Thomas, as we discussed offline, I really don't like the necessity of the hidden_deps part of this, so I've tried coming up with some other solutions. For example, in my testing I get the same result with the following diff instead of the second two patches (just showing for mlx5 - changes for mlx4 are identical): --- a/drivers/net/mlx5/meson.build +++ b/drivers/net/mlx5/meson.build @@ -31,10 +31,7 @@ foreach libname:libnames endif if lib.found() libs += lib - if static_ibverbs - # Build without adding shared libs to Requires.private - hidden_deps += lib.partial_dependency(compile_args:true) - else + if not static_ibverbs ext_deps += lib endif else @@ -44,8 +41,10 @@ foreach libname:libnames endforeach if build and static_ibverbs # Add static deps ldflags to internal apps and Libs.private - ldflags = run_command(ldflags_ibverbs_static, check:true).stdout() - ext_deps += declare_dependency(link_args:ldflags.split()) + ibv_ldflags = run_command(ldflags_ibverbs_static, check:true).stdout() + ibv_cflags = run_command(find_program('pkg-config'), '--cflags', 'libibverbs').stdout() + ext_deps += declare_dependency(compile_args: ibv_cflags.split(), + link_args:ibv_ldflags.split()) endif if build By doing things this way - assuming it works in your tests too - we avoid any need to change anything in the common drivers code. How I tested this was by: * doing a local rdma-core build as described in the docs and exporting PKG_CONFIG_PATH to point to the .pc file * doing builds with all 4 of your patches applied (one static linking of apps, one shared, just in case) * doing builds with the first two patches and the above diff. * compare the meson.build files and libdpdk.pc files for the two cases. In my tests the second case as additional -I flags, but otherwise identical. Regards, /Bruce