From patchwork Tue Feb 11 01:19:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 65713 X-Patchwork-Delegate: rasland@nvidia.com 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 39747A051C; Tue, 11 Feb 2020 02:20:02 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 57B821B9BF; Tue, 11 Feb 2020 02:20:01 +0100 (CET) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id CC6C214583 for ; Tue, 11 Feb 2020 02:19:59 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 40E9C21A97; Mon, 10 Feb 2020 20:19:59 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 10 Feb 2020 20:19:59 -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=G9yi9al0kS HWJM7BiIrqewsvjlg5RS0sNZ64cdX7dEY=; b=mNuNP72hmhHPTiD+atKrkJuKOT Dvek6UwKcepOAVbKgy5uPhNkzgjPKSs+R9DjBXpSXhf8oH3CICgYBTmbFcGbSg2L ISGK3RQdDfD0LRmWh8bNPIOAtyIw7JuTn/+S5nEovev7Ve9vnXosGRuJprQ596ZK di+cqQgvYM2775VJ8= 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=G9yi9al0kSHWJM7BiIrqewsvjlg5RS0sNZ64cdX7dEY=; b=a5s1048s xOdFWqnwHfYH8AP7OjW775+tpCCUo60gpU6ypMHBa5oR7zhoyYEfQc9uMAtaNgmB CLLvAgH5yi9/9DJeqbQJ2VIxuOc4NzrwIylx5YDjXBTGxfkM/MdCGGKgA+kjuAug dHXGQgxHHOxartJO4LSGpmn0r4nl+PVNYL7EX4Qf+PZ2JNMNK5ZVFCtq0SnPNyZc z9nyzIwkMX8USLLPU44v+3F2DJiF5HlmPPN7ADMkUHfNdr98ljQ7k6HIvd548aCR arZ3lwnpWk92qazwLgrrVYssKwv1r7/8ARqHwJLKbIXDAzHi1XE9ZSmnteMCUsY8 JHKnylJkaVxyTg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedriedvgdefvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkph epjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr rghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth 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 4185A3280059; Mon, 10 Feb 2020 20:19:58 -0500 (EST) From: Thomas Monjalon To: dev@dpdk.org Cc: bruce.richardson@intel.com, Matan Azrad , Shahaf Shuler , John McNamara , Marko Kovacevic , Viacheslav Ovsiienko Date: Tue, 11 Feb 2020 02:19:38 +0100 Message-Id: <20200211011942.1569573-2-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 Subject: [dpdk-dev] [PATCH v3 1/5] net/mlx: add static ibverbs 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" The libibverbs (and libmlx4/5) can be statically embedded in the shared PMD library, or in the application with the static PMD. It was supported with make build system in commit 2c0dd7b69fb0 ("config: add static linkage of mlx dependency"). The same feature is enabled with meson when using pkg-config (i.e. only if the call to dependency() is successful). The fallback method for searching library with cc.find_library() is not supported because the dependencies of the found library would not be linked (no such info in .a file unlike .so). The main difference, in meson build system, is the generated .pc file giving arguments to link DPDK with the application. Unfortunately the .pc file will not keep memory of the static linkage option for libibverbs. Signed-off-by: Thomas Monjalon --- doc/guides/nics/mlx4.rst | 4 ++++ doc/guides/nics/mlx5.rst | 4 ++++ drivers/common/mlx5/meson.build | 5 +++-- drivers/net/mlx4/meson.build | 5 +++-- meson_options.txt | 4 ++-- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/doc/guides/nics/mlx4.rst b/doc/guides/nics/mlx4.rst index d0e8a8b2ff..4b1d1aceb2 100644 --- a/doc/guides/nics/mlx4.rst +++ b/doc/guides/nics/mlx4.rst @@ -92,6 +92,10 @@ These options can be modified in the ``.config`` file. adds additional run-time checks and debugging messages at the cost of lower performance. +This option is available in meson: + +- ``ibverbs_link`` can be ``static``, ``shared``, or ``dlopen``. + Environment variables ~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index 2411fb3461..ffab34d281 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -278,6 +278,10 @@ These options can be modified in the ``.config`` file. 64. Default armv8a configuration of make build and meson build set it to 128 then brings performance degradation. +This option is available in meson: + +- ``ibverbs_link`` can be ``static``, ``shared``, or ``dlopen``. + Environment variables ~~~~~~~~~~~~~~~~~~~~~ diff --git a/drivers/common/mlx5/meson.build b/drivers/common/mlx5/meson.build index 9cbd527cae..f24e421bc3 100644 --- a/drivers/common/mlx5/meson.build +++ b/drivers/common/mlx5/meson.build @@ -8,6 +8,7 @@ if not is_linux endif build = true +static_ibverbs = (get_option('ibverbs_link') == 'static') pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE = 'librte_pmd_mlx5_glue.so' LIB_GLUE_VERSION = '20.02.0' @@ -23,8 +24,8 @@ endif libnames = [ 'mlx5', 'ibverbs' ] libs = [] foreach libname:libnames - lib = dependency('lib' + libname, required:false) - if not lib.found() + lib = dependency('lib' + libname, static:static_ibverbs, required:false) + if not lib.found() and not static_ibverbs lib = cc.find_library(libname, required:false) endif if lib.found() diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build index 0260c5dc59..8696f6ebdf 100644 --- a/drivers/net/mlx4/meson.build +++ b/drivers/net/mlx4/meson.build @@ -9,6 +9,7 @@ if not is_linux endif build = true +static_ibverbs = (get_option('ibverbs_link') == 'static') pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE = 'librte_pmd_mlx4_glue.so' LIB_GLUE_VERSION = '18.02.0' @@ -24,8 +25,8 @@ endif libnames = [ 'mlx4', 'ibverbs' ] libs = [] foreach libname:libnames - lib = dependency('lib' + libname, required:false) - if not lib.found() + lib = dependency('lib' + libname, static:static_ibverbs, required:false) + if not lib.found() and not static_ibverbs lib = cc.find_library(libname, required:false) endif if lib.found() diff --git a/meson_options.txt b/meson_options.txt index 20be15fe6b..9e4923a4f1 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -14,8 +14,8 @@ option('examples', type: 'string', value: '', description: 'Comma-separated list of examples to build by default') option('flexran_sdk', type: 'string', value: '', description: 'Path to FlexRAN SDK optional Libraries for BBDEV device') -option('ibverbs_link', type: 'combo', choices : ['shared', 'dlopen'], value: 'shared', - description: 'Linkage method (shared/dlopen) for Mellanox PMDs with ibverbs dependencies.') +option('ibverbs_link', type: 'combo', choices : ['static', 'shared', 'dlopen'], value: 'shared', + description: 'Linkage method (static/shared/dlopen) for Mellanox PMDs with ibverbs dependencies.') option('include_subdir_arch', type: 'string', value: '', description: 'subdirectory where to install arch-dependent headers') option('kernel_dir', type: 'string', value: '', From patchwork Tue Feb 11 01:19:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 65715 X-Patchwork-Delegate: rasland@nvidia.com 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 D002DA051C; Tue, 11 Feb 2020 02:20:23 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 00D5F1BF9C; Tue, 11 Feb 2020 02:20:05 +0100 (CET) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 5F40D1BF7A for ; Tue, 11 Feb 2020 02:20:02 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id A7E0621FBC; Mon, 10 Feb 2020 20:20:01 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 10 Feb 2020 20:20:01 -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=6711hToojC 2tXwPiTgG2PV8Q5PellWmvK3/lkPrvOE4=; b=YNNxSHCDsczHlRvMREFnrR+WXY p5i9QoQPBXxKsLfb+0RfNiDfh4IwQs97AFE5XTuV6JY/YxT2iAhxanLTdYxT+GP6 QxcLYqREFnOHEujvf7fYyI6hcLU/xTjMUlS6IBFEMj6ic9o+gtRLZJNIEplRrTCp lrKz/Z3jmq0zD/pGQ= 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=6711hToojC2tXwPiTgG2PV8Q5PellWmvK3/lkPrvOE4=; b=gFP6BK1f u+CNPIwQYbUc+Qt+vIVb2wkZQEj3olQY5T/qpmtYllZ0bPAgxR52ChVIC2+rj9H/ 8sD42KaUFV6zbThQwFEg92aqSQ6Prv8v26abmj9leEF00+4YDG49Zw8skHbwRAf9 WxjZ5tXE8y3iW9Vwpo3IT7XBiNO8dz3P1H2OwkZ5Z7U9P1xFP14gxCFVLlYtk1aZ zOuVOglFZNb82cCh3VMEJQe509dNxor3Uf+Wc66LwJvzPn3Qk4Jy0KAI9xjINiUO 8V526B9c1eN2qvqN0aZayrtan/skC2aPKCe2A/+aPfvyPRH3S4kfxXIuIwX/mzcd iHlX4DEJc16iyQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedriedvgdefvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkph epjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuihiivgepvdenucfrrghr rghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth 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 D5D6C3280059; Mon, 10 Feb 2020 20:20:00 -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:39 +0100 Message-Id: <20200211011942.1569573-3-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 Subject: [dpdk-dev] [PATCH v3 2/5] buildtools: get static mlx dependencies for 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" The shell script options-ibverbs-static.sh was used with make in forcing static linkage of ibverbs libraries. When choosing to link with a static dependency in meson, the generated .pc file will not force such static linkage. The solution will rely on using this script in meson. If linking with libraries installed in a non-standard path, an option -L is provided via EXTRA_LDFLAGS in case of using make. With meson, tuning PKG_CONFIG_PATH for pkg-config should be enough. When statically linking an application, the .pc file must save the -L path so the application link will work without any extra option. That's why --libs-only-l is replaced with --libs which includes -L. Options which are neither -l or -L are filtered out because not needed and can cause compilation issues with the legacy system using make. The other change in this script is to move the main library file (libiverbs.a) at the end of the list of dependencies. It fixes some undefined references when linking a static application using libdpdk.pc. Signed-off-by: Thomas Monjalon --- buildtools/options-ibverbs-static.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/buildtools/options-ibverbs-static.sh b/buildtools/options-ibverbs-static.sh index 0f285a343b..43578a37f3 100755 --- a/buildtools/options-ibverbs-static.sh +++ b/buildtools/options-ibverbs-static.sh @@ -9,6 +9,12 @@ # # PKG_CONFIG_PATH may be required to be set if libibverbs.pc is not installed. -pkg-config --libs-only-l --static libibverbs | +lib='libibverbs' +deps='pthread|nl' + +pkg-config --libs --static $lib | tr '[:space:]' '\n' | - sed -r '/^-l(pthread|nl)/! s,(^-l)(.*),\1:lib\2.a,' + sed -r "/^-l($deps)/! s,(^-l)(.*),\1:lib\2.a," | # explicit .a + sed -n '/^-[Ll]/p' | # extra link options may break with make + sed "/$lib/d" # move main lib at the end +echo -l:$lib.a From patchwork Tue Feb 11 01:19:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 65716 X-Patchwork-Delegate: rasland@nvidia.com 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 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 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', From patchwork Tue Feb 11 01:19:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 65717 X-Patchwork-Delegate: rasland@nvidia.com 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 12313A051C; Tue, 11 Feb 2020 02:20:41 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8F9E01BFA8; Tue, 11 Feb 2020 02:20:07 +0100 (CET) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 42CBE1BF7C for ; Tue, 11 Feb 2020 02:20:06 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id E4F4E21FE6; Mon, 10 Feb 2020 20:20:05 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 10 Feb 2020 20:20:05 -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=4OwBvK0NoM V6228KY+Q+5B541z+rmukxAnkRgyfDWv0=; b=Jxi0DNE10T4v829wnHCdQiCRPL gUpix5lfLMSv+IrNB9FrYpb5n4YvSIkMrohezMG1wiA7Kg9L5Y/hRGWRMWUm2T98 F1KNCQw4B2mM65qln/bEy44gRSqkUqbIhEW7syxoRCC4Vudkgp6mlXX2vulIBowS eRjM8VaqRnZcTyz6k= 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=4OwBvK0NoMV6228KY+Q+5B541z+rmukxAnkRgyfDWv0=; b=xi/fd9Iu tgQ3Ecpl1PfIfpSAG6HjExQYRXnOcbww34JTnsAN4StSEDfZsuCRrzY/plGhSub0 dBBTKvLIImFPxtXG4MsomnXyuWtc3Prawk2PKKyFsfd5zepM7Dpzb2h9aofURyI1 5qmfAmaH8fFKIaJlHr4xzqtNtugDTPk7KJqoC4N3plk6ShIG0ef1KVfh5OQIZfAK LYJiN38WSHfRBq6w4GJzslA0fmXD2R55Y3ONb0oADuAX1A9smnFdWfuCU9Csy3No mMCKGfh5KXdFenys4I2LTSNEtqfh5ploLXw2dsr6sp2Aqh9et40dNfj/ClQNjR31 LjJ+UVce4VgRww== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedriedvgdefvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkph epjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuihiivgepvdenucfrrghr rghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth 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 225B13280059; Mon, 10 Feb 2020 20:20:05 -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:41 +0100 Message-Id: <20200211011942.1569573-5-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 Subject: [dpdk-dev] [PATCH v3 4/5] net/mlx: rename meson variable for dlopen option 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" The name of the variable pmd_dlopen is confusing because it can be understood as true if the PMD is dlopen, whereas it means the ibverbs glue layer is a dlopen library. That's why it is renamed dlopen_ibverbs. Signed-off-by: Thomas Monjalon --- drivers/common/mlx5/meson.build | 8 ++++---- drivers/net/mlx4/meson.build | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/common/mlx5/meson.build b/drivers/common/mlx5/meson.build index bf04d16d76..2bb2a83c45 100644 --- a/drivers/common/mlx5/meson.build +++ b/drivers/common/mlx5/meson.build @@ -9,11 +9,11 @@ endif build = true static_ibverbs = (get_option('ibverbs_link') == 'static') -pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') +dlopen_ibverbs = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE = 'librte_pmd_mlx5_glue.so' LIB_GLUE_VERSION = '20.02.0' LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION -if pmd_dlopen +if dlopen_ibverbs dpdk_conf.set('RTE_IBVERBS_LINK_DLOPEN', 1) cflags += [ '-DMLX5_GLUE="@0@"'.format(LIB_GLUE), @@ -55,7 +55,7 @@ if build 'mlx5_common.c', 'mlx5_nl.c', ) - if not pmd_dlopen + if not dlopen_ibverbs sources += files('mlx5_glue.c') endif cflags_options = [ @@ -194,7 +194,7 @@ if build configure_file(output : 'mlx5_autoconf.h', configuration : config) endif # Build Glue Library -if pmd_dlopen and build +if dlopen_ibverbs and build dlopen_name = 'mlx5_glue' dlopen_lib_name = 'rte_pmd_@0@'.format(dlopen_name) dlopen_so_version = LIB_GLUE_VERSION diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build index cf53a6b3e1..2970f395c1 100644 --- a/drivers/net/mlx4/meson.build +++ b/drivers/net/mlx4/meson.build @@ -10,11 +10,11 @@ endif build = true static_ibverbs = (get_option('ibverbs_link') == 'static') -pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') +dlopen_ibverbs = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE = 'librte_pmd_mlx4_glue.so' LIB_GLUE_VERSION = '18.02.0' LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION -if pmd_dlopen +if dlopen_ibverbs dpdk_conf.set('RTE_IBVERBS_LINK_DLOPEN', 1) cflags += [ '-DMLX4_GLUE="@0@"'.format(LIB_GLUE), @@ -62,7 +62,7 @@ if build 'mlx4_txq.c', 'mlx4_utils.c', ) - if not pmd_dlopen + if not dlopen_ibverbs sources += files('mlx4_glue.c') endif cflags_options = [ @@ -114,7 +114,7 @@ if build configure_file(output : 'mlx4_autoconf.h', configuration : config) endif # Build Glue Library -if pmd_dlopen and build +if dlopen_ibverbs and build dlopen_name = 'mlx4_glue' dlopen_lib_name = driver_name_fmt.format(dlopen_name) dlopen_so_version = LIB_GLUE_VERSION From patchwork Tue Feb 11 01:19:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 65718 X-Patchwork-Delegate: rasland@nvidia.com 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 CE76CA051C; Tue, 11 Feb 2020 02:20:49 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3214A1BFAD; Tue, 11 Feb 2020 02:20:09 +0100 (CET) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 7E3F71BFAD; Tue, 11 Feb 2020 02:20:08 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 23C2321A97; Mon, 10 Feb 2020 20:20:08 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 10 Feb 2020 20:20:08 -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=1qLPOwisO/ FCB+O0hqC7JvtnYcaJ+LWUemuQao5m/4A=; b=S9vDjBogIyLx+L62nTe/7hz+GY QwVZwR+MlYu5UsZ03n+lLhoAywXS/suZJOYRkMMqM+yBMLm0TbT+kaWyUSEfzTsv AZksN83ETyGqMv+Gf3ACiXH9u9AVOMp53FufdMufhtijphykSLRMGfbkTLkqyAS6 8FouWMl7z0jRb6Jqk= 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=1qLPOwisO/FCB+O0hqC7JvtnYcaJ+LWUemuQao5m/4A=; b=r7kkuz/n dipcGxFWyoi1czak9GjxlWceBMvWkxT0ACLAKu5PTLyW7Lm1DO4x6RV2V1i75iI4 37019OQAtZkRW8PB+D8WeV8zSFAMv4xRDtQYdK7+uB8fYvGDCPBiLC9+5FnSk5qe 5vmx29E7igznoni2E6rSen6oxVW8pTRD3iLR1wdGH1aFX32EHvYrul+nLVarBIGU zokpmIDdf/+a33P5hPGvnJlpSUWW/UrC7H/pXGl2WG2yBKr/LzdM2fkU5B0z3vS2 olfCPSHAFWloSwjufROCaugoR0c7W4sPiXyca4hKT9UfO/eNAJhJ8Ie7maaWGW4w 6FnVxaUUGRZMiA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedriedvgdefvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkph epjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuihiivgepgeenucfrrghr rghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth 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 0CED2328005D; Mon, 10 Feb 2020 20:20:06 -0500 (EST) From: Thomas Monjalon To: dev@dpdk.org Cc: bruce.richardson@intel.com, stable@dpdk.org, Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko , =?utf-8?q?N=C3=A9lio_Laran?= =?utf-8?q?jeiro?= Date: Tue, 11 Feb 2020 02:19:42 +0100 Message-Id: <20200211011942.1569573-6-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 Subject: [dpdk-dev] [PATCH v3 5/5] net/mlx: fix overlinking with meson and glue dlopen 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 dlopen, the PMD and application should not be linked with ibverbs, but the glue library is. Unfortunately the ibverbs dependency was exported in the variable ext_deps, so there were overlinking. It is fixed by not exporting the dependency in ext_deps, and recreating a limited dependency object for cflags only. Fixes: 1dd7c7e38c19 ("net/mlx4: support meson build") Fixes: 96d7c62a70c7 ("net/mlx5: support meson build") Cc: stable@dpdk.org Signed-off-by: Thomas Monjalon --- drivers/common/mlx5/meson.build | 6 ++++-- drivers/net/mlx4/meson.build | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/common/mlx5/meson.build b/drivers/common/mlx5/meson.build index 2bb2a83c45..2956fc20e2 100644 --- a/drivers/common/mlx5/meson.build +++ b/drivers/common/mlx5/meson.build @@ -30,7 +30,7 @@ foreach libname:libnames endif if lib.found() libs += lib - if not static_ibverbs + if not static_ibverbs and not dlopen_ibverbs ext_deps += lib endif else @@ -38,10 +38,12 @@ foreach libname:libnames reason = 'missing dependency, "' + libname + '"' endif endforeach -if build and static_ibverbs +if build and (static_ibverbs or dlopen_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()) +endif +if build and static_ibverbs # 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()) diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build index 2970f395c1..bcfe5b0890 100644 --- a/drivers/net/mlx4/meson.build +++ b/drivers/net/mlx4/meson.build @@ -31,7 +31,7 @@ foreach libname:libnames endif if lib.found() libs += lib - if not static_ibverbs + if not static_ibverbs and not dlopen_ibverbs ext_deps += lib endif else @@ -39,10 +39,12 @@ foreach libname:libnames reason = 'missing dependency, "' + libname + '"' endif endforeach -if build and static_ibverbs +if build and (static_ibverbs or dlopen_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()) +endif +if build and static_ibverbs # 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())