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 F1868A051C; Tue, 11 Feb 2020 02:20:31 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4E0F41BFA2; Tue, 11 Feb 2020 02:20:06 +0100 (CET) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 33DC91BF98 for ; Tue, 11 Feb 2020 02:20:04 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id D934521F15; Mon, 10 Feb 2020 20:20:03 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 10 Feb 2020 20:20:03 -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=VZLzkexi4U aBvdjvaQ0Cz4BkHUvPOImJH1nnPTC/MKo=; b=pOqKLMiS0w71hiYMt/98aGQOyv BnLmez8ekogGOmk2xfy1hnTEX30n+ZRQDgKTacWwuS88RpEltLlMX/ssQWmdcA+l cMMGCjAqI4XEK5yEGuW/OT/iQ/U+MAHMaLr6YJJCysfE2iREb4FtA88+KM6UFXPp xMf1on1rAfIIHBoYA= 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=VZLzkexi4UaBvdjvaQ0Cz4BkHUvPOImJH1nnPTC/MKo=; b=cqDs83GM a1JWSoNcmGlPRRBRHeu0Hrp/szBFXKfQG6b8qTenJMTvhpKhnAknaSdsuLKWj6Vl 630BQ1ae3gaWtWgfN4Hg3EMmjmQbmqypg2YjPQB9vmd4vQtz9OrpUmv4P1eOIQ5C AfacXcQXbbL58p0zLnKVYHXlFDfzfddfEjVD76AY4+IE16vDqiWTCbeVB3jn/3M0 R29W86i+SF0DlZE75+lxS8hzZURwXfUmepNa5frrM3CQNr3/NqKA4cOl/ZB+2m5Q qJy09yyfB8RU76KCmN+hNS403M5yqFdMqXWKaddHK4lR+F+G0ZPfjn0cSdm0KC3N n1LzBaue6a3Aiw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedriedvgdefvdcutefuodetggdotefrodftvf 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 19603328005A; Mon, 10 Feb 2020 20:20:03 -0500 (EST) From: Thomas Monjalon To: dev@dpdk.org Cc: bruce.richardson@intel.com, Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko Date: Tue, 11 Feb 2020 02:19:40 +0100 Message-Id: <20200211011942.1569573-4-thomas@monjalon.net> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200211011942.1569573-1-thomas@monjalon.net> References: <20200127154402.4008069-1-thomas@monjalon.net> <20200211011942.1569573-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [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" 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 if build 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 8696f6ebdf..cf53a6b3e1 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 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 if build allow_experimental_apis = true - ext_deps += libs sources = files( 'mlx4.c', 'mlx4_ethdev.c', -- 2.25.0