From patchwork Mon Jan 27 15:44:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 65155 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6B3E3A0531; Mon, 27 Jan 2020 16:44:58 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 67CAA1BFEC; Mon, 27 Jan 2020 16:44:31 +0100 (CET) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 2B8B41BFE0 for ; Mon, 27 Jan 2020 16:44:28 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id BD41B22139; Mon, 27 Jan 2020 10:44:27 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 27 Jan 2020 10:44:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=mesmtp; bh=n0GBEB3nbL O5dQaWQDOt6X/yl6cVy1jyUBpHZDmphPk=; b=ilxtyeLy8rovboqxBV7rP5r3n4 3PvfdSu5YT/LrzFDurMDAsxar7estPy2V8+nerVUvqExURPVy5LT5HP20oBQDiQv 38kynb1b5JkK4gUJDtMTXIjVbhe4KBh7nm6WpQBO32yZGD0hee/LxMHCoPgIHR1Q gWQePywY+lEaTKF2I= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=n0GBEB3nbLO5dQaWQDOt6X/yl6cVy1jyUBpHZDmphPk=; b=Jg/wh9f4 pT6rFP1yKQL7SCdUwUoe2leMh7CyBGp4SgFWA6wAfxTeXU7v5ZUg1ftg9C53Z0Jx haxOcqpYrTVTxvJD4xza0bc8EgPnhEltLc9dYm6G9vWgVknqcGaywxNFEVaga0gu enq+DNljDhEBZ9Zw9nyiG5a7DqDEJ5qiLu/fkgy2zLlwwCv/6yp30xbPtsZEY3T5 qznnIFVHKcloj+ugsgVCFNrMtKFn67+Pmn6HYLekXO6L+p3GsVUydUt9B4C6X1Iy eZ5EIeAbjN9ZYPdiB32Cmu+SXB6S91wlrJJDaSP3P8qVYCXeCM/dkvYdyLYWJgCQ +jroOKhN5xj2cA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrfedvgdejkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucffoh hmrghinhepghhithhhuhgsrdgtohhmnecukfhppeejjedrudefgedrvddtfedrudekgeen ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomh grshesmhhonhhjrghlohhnrdhnvght X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 00F36328005E; Mon, 27 Jan 2020 10:44:26 -0500 (EST) From: Thomas Monjalon To: dev@dpdk.org Cc: bruce.richardson@intel.com, Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko Date: Mon, 27 Jan 2020 16:44:02 +0100 Message-Id: <20200127154402.4008069-5-thomas@monjalon.net> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200127154402.4008069-1-thomas@monjalon.net> References: <20200116071656.1663967-1-thomas@monjalon.net> <20200127154402.4008069-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 4/4] 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" 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 not allow meson suggesting shared libraries in the section Requires.private of the .pc file, the cflags are passed as hidden_deps. The list of required dependencies is replaced with ldflags, forcing 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 --- buildtools/meson.build | 2 ++ drivers/net/mlx4/meson.build | 14 ++++++++++++-- drivers/net/mlx5/meson.build | 14 ++++++++++++-- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/buildtools/meson.build b/buildtools/meson.build index cd1d054036..2a25527385 100644 --- a/buildtools/meson.build +++ b/buildtools/meson.build @@ -7,6 +7,8 @@ pmdinfo = find_program('gen-pmdinfo-cfile.sh') 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) if python3.found() diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build index 51d9784ee2..724256bfb4 100644 --- a/drivers/net/mlx4/meson.build +++ b/drivers/net/mlx4/meson.build @@ -30,16 +30,26 @@ foreach libname:libnames lib = cc.find_library(libname, required:false) endif if lib.found() - libs += [ lib ] + libs += lib + if static_ibverbs + # Build without adding shared libs to Requires.private + hidden_deps += lib.partial_dependency(compile_args:true) + else + ext_deps += lib + endif else build = false reason = 'missing dependency, "' + libname + '"' endif 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()) +endif if build allow_experimental_apis = true - ext_deps += libs sources = files( 'mlx4.c', 'mlx4_ethdev.c', diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build index a4f2f79f22..e04c8947e0 100644 --- a/drivers/net/mlx5/meson.build +++ b/drivers/net/mlx5/meson.build @@ -30,17 +30,27 @@ foreach libname:libnames lib = cc.find_library(libname, required:false) endif if lib.found() - libs += [ lib ] + libs += lib + if static_ibverbs + # Build without adding shared libs to Requires.private + hidden_deps += lib.partial_dependency(compile_args:true) + else + ext_deps += lib + endif else build = false reason = 'missing dependency, "' + libname + '"' endif 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()) +endif if build allow_experimental_apis = true deps += ['hash'] - ext_deps += libs sources = files( 'mlx5.c', 'mlx5_ethdev.c',