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 D075DA0534; Wed, 12 Feb 2020 23:07:55 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B85661BFBE; Wed, 12 Feb 2020 23:07:22 +0100 (CET) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id EE32F1BF7C for ; Wed, 12 Feb 2020 23:07:18 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 91F1F21443; Wed, 12 Feb 2020 17:07:18 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Wed, 12 Feb 2020 17:07:18 -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=k0OvKrzm0n md8OMi52dW8IYWS4xKath9B3M/MyofQME=; b=LF8nVjUNRTLoTGEevTOZk90H/g aBBEI86eI1J1GnnYoPeub78aQMj8ezcB6bbzpaOCN0IrXkytrahqOsYbzGrrNm0A VJtDeowmJnZxUPV0QhMjR/Br/fSkAhbFr/ChfJabo4G/7MuMe37TmqEFUujZqJ6w ePxhaO2glHeETTHrY= 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= fm2; bh=k0OvKrzm0nmd8OMi52dW8IYWS4xKath9B3M/MyofQME=; b=buBsa1uM 8+T3FMg2ytuFz4lCMD3WI5S6Kj92I804b3rgG15U/637Y5S/Jk8sjCULnONaPImp rTntHDEX7Snj2a5tlylgTWABb8JRx+NA/gzFqbsA4w0WIjmzIKf/oRkaiq04b0ze sdc3VHY7rke7SdIZRWp35iGiezpe3h11VGIluzkaHs2RKBVARBRLVAk8JAyLc7pt VgcmIc4VJ1g+sC7HhVlepMqSnM+0hfgg8NBr/lFB6bw2447EZP+9AYWQKSvzlYLI Px52cY72m65/S0NM7yqC5PWvHgWt9EYCg34L3DW9wn0B0l2V8rkc5DtuXaQD1EG1 qNotYBHxkBo39Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrieeigddvvdcutefuodetggdotefrodftvf 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 C365630600DC; Wed, 12 Feb 2020 17:07:17 -0500 (EST) From: Thomas Monjalon To: dev@dpdk.org Cc: bruce.richardson@intel.com, Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko Date: Wed, 12 Feb 2020 23:07:06 +0100 Message-Id: <20200212220708.492297-5-thomas@monjalon.net> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200212220708.492297-1-thomas@monjalon.net> References: <20200116071656.1663967-1-thomas@monjalon.net> <20200212220708.492297-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v5 4/6] 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 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..9812917e50 100644 --- a/buildtools/meson.build +++ b/buildtools/meson.build @@ -3,9 +3,11 @@ subdir('pmdinfogen') +pkgconf = find_program('pkg-config', 'pkgconf', required: false) 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 47ae1b65c2..4e987ed277 100644 --- a/drivers/common/mlx5/meson.build +++ b/drivers/common/mlx5/meson.build @@ -29,16 +29,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 + '"' subdir_done() endif endforeach +if 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 allow_experimental_apis = true deps += ['hash', 'pci', 'net', 'eal', 'kvargs'] -ext_deps += libs sources = files( 'mlx5_devx_cmds.c', 'mlx5_common.c', diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build index 7513516764..290bd1e268 100644 --- a/drivers/net/mlx4/meson.build +++ b/drivers/net/mlx4/meson.build @@ -29,16 +29,26 @@ foreach libname:libnames lib = cc.find_library(libname, required:false) endif if lib.found() - libs += [ lib ] + libs += lib + if not static_ibverbs + ext_deps += lib + endif else build = false reason = 'missing dependency, "' + libname + '"' subdir_done() endif endforeach +if 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 allow_experimental_apis = true -ext_deps += libs sources = files( 'mlx4.c', 'mlx4_ethdev.c', -- 2.25.0