From patchwork Mon Jan 27 15:43:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 65152 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 EA5B2A0531; Mon, 27 Jan 2020 16:44:25 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 819FF1BFB5; Mon, 27 Jan 2020 16:44:20 +0100 (CET) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 2E0521BFB4 for ; Mon, 27 Jan 2020 16:44:19 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 7004621B42; Mon, 27 Jan 2020 10:44:17 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 27 Jan 2020 10:44:17 -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=nLzJ8sKuZx /tJ/2uMkYv/Ps3dBQD1z1fRs1zoYCld90=; b=L43Kd/fSYlRWRGC9KdG6nuCoin PExOu3AZ476D9VGHPr1Ht2AU2itv6CnsSmlfUi+nAsgJXfH3clNDA0D2YifA5kzi P1C0Qy4pqC/YJq5ZNIRSY1ihgBP7bcd9yJMTvi9RO8oGpQ0bBcPHY9o6xc7VeuZI ztSKB9wtwfFClJy8E= 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=nLzJ8sKuZx/tJ/2uMkYv/Ps3dBQD1z1fRs1zoYCld90=; b=QfZ5FnSy 3VqAK0qVNvklfq7VYzil38p3Ph+SieuVOY1aDMPnztnzpiGBnBY5Et11ur4liC8n ZH0z+Kncww9khQO2rxhmhtRjQ7yHKUOR6bdcV1AG4XaD6HLwZkF/C+HG3DpSMOaD fwapknw9b2+7mTuL84WEgMWIyBLC4KVpzX78XWmSwUQfpqiVy+kGQJe30ktTM3RV 3b1vP8Hi2zJjvrSEbY2Z7BccXH4yLegK8A9WFK+Tbl1MQh2N1ooY8ZtJyILJA4vp HeraO2nnxkZ/RiBR+52PDS3ejkzA41QuFfWGwjiYE3AFCEGenCddRBO4dszk9qKg +U8bJf63BMzBSA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrfedvgdejkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkph epjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuihiivgepudenucfrrghr 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 8D4AC3280066; Mon, 27 Jan 2020 10:44:16 -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: Mon, 27 Jan 2020 16:43:59 +0100 Message-Id: <20200127154402.4008069-2-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 1/4] 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/net/mlx4/meson.build | 5 +++-- drivers/net/mlx5/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 66997f1ae7..b3bd3bba34 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/net/mlx4/meson.build b/drivers/net/mlx4/meson.build index 9eb4988420..51d9784ee2 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/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build index 3ad4f02a53..a4f2f79f22 100644 --- a/drivers/net/mlx5/meson.build +++ b/drivers/net/mlx5/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_mlx5_glue.so' LIB_GLUE_VERSION = '20.02.0' @@ -24,8 +25,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/meson_options.txt b/meson_options.txt index 53dfe13c30..0a02f2faf9 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -12,8 +12,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 Mon Jan 27 15:44:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 65153 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 A5A43A0531; Mon, 27 Jan 2020 16:44:36 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3330B1BFC4; Mon, 27 Jan 2020 16:44:24 +0100 (CET) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id CEEB01BFC4 for ; Mon, 27 Jan 2020 16:44:20 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 5D12721F3C; Mon, 27 Jan 2020 10:44:20 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 27 Jan 2020 10:44:20 -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=G/VX32R447 d6Woo4eizDozIsDMCpp7lY76O1MNQVlJA=; b=LckhguVii7OVA8HZ9HMTU2xlbK xveTL4iANEOHl6xzGwfQWcMnYK5P0douaEfvd1JEe2Snn/K9R4ES1kAQZlaSz4KY YKUI1HUuxGAxyxi6wqfYnvxNuM5Fm9bDNUnFKBhUMMQtmd7/at8EMO+P6fkJlaW3 buK9B028lyefUQevE= 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=G/VX32R447d6Woo4eizDozIsDMCpp7lY76O1MNQVlJA=; b=FOMR6PJN Sof4uTSLz1RWauf3hO0xNbStihAN7xDauRwQnlNoqKEqGjWq0GPprEVj6h+X7xri ScWcQoGTxAv6wBP+L9s3xx+jBI4HXk49WXrky4A65oBzY3HRKzuxlL+nOlM/Op2a sMu3qI1XLC3pNB4dBFWZzSyVqLqbLcLsBZE+8TwL+hiBrS2wMferNm4s4LdElBH5 wyPIug9R0SE7Jg3cHhmR8KfDT8p5WppzY5b/P2zt47LQXtVwtRMW/JTLDpZCi20w Zu0TbkwtiuLDCHeER0b+3JPfNFAWVgbqqNmgy2bxke3XkE54dor51YnXu1qA0uvb Jv7rMbPrkVhnbw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrfedvgdejkecutefuodetggdotefrodftvf 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 947E73280065; Mon, 27 Jan 2020 10:44:19 -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:00 +0100 Message-Id: <20200127154402.4008069-3-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 2/4] 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 Mon Jan 27 15:44:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 65154 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 25980A0531; Mon, 27 Jan 2020 16:44:46 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 723781BFDC; Mon, 27 Jan 2020 16:44:27 +0100 (CET) Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by dpdk.org (Postfix) with ESMTP id 664681BFD7 for ; Mon, 27 Jan 2020 16:44:25 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 2144C514; Mon, 27 Jan 2020 10:44:24 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 27 Jan 2020 10:44:24 -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=dcqF5qHPCL HC7Iy91t1SItYcXZTadmujr+mIlwjo2IM=; b=YTp7dkCLHXjuG4j+BDRvTh7xYY CU0KlfFwXj2t9XEo5JpLrWABhZI7hEX4rjjJvfflOdbS0euuEq71dyEHgXORzDt7 8lJ3aaImWrutMDfjI0I8tRoMvHPye4Nhu2yIhEruztSukbxRNeG1XwFOU8iPkPX3 jJNTEo8SSxggM20Os= 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=dcqF5qHPCLHC7Iy91t1SItYcXZTadmujr+mIlwjo2IM=; b=Jzh71L/K 0WfrbWofKFlzVDv+k8Q1Z48d9ZN/HsNAtS35IxM8vWN5b0OpZUH2Qo+/sGGx20bu LAuNdh/vJ4do5LIReekGMpv+uWRZ0oPiRwsZ9UxTBRGSTOM5RoSHE2IShr8Ssv65 gEIgr/0KygXZdHuJe5kc5u81wtWvVdGfiNB0UepH/0AlnMzp/zFsv88z7+aCPbes YzPzjkhy4jjaE2aF7tuTt1FZdmL/AM2K6NKjEkYuYrXlkbap56+gi4/q0FQwFM3f qWeEjoV0ZY1Un2ozNrkX50u3prOkMyFvL1OgGsgSlRxj6OiLA7a0WfZNJ2t4XobR /InrDIBxm7xQLg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrfedvgdejkecutefuodetggdotefrodftvf 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 1A1643280063; Mon, 27 Jan 2020 10:44:23 -0500 (EST) From: Thomas Monjalon To: dev@dpdk.org Cc: bruce.richardson@intel.com, John McNamara , Marko Kovacevic Date: Mon, 27 Jan 2020 16:44:01 +0100 Message-Id: <20200127154402.4008069-4-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 3/4] build: allow hiding dependencies from pkg-config 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 a dependency is required for a driver build, but should not be exposed to the application (via pkg-config), it can be declared in the array hidden_deps. The hidden_deps are used as internal dependencies, when building the shared library and the first stage of static library. The final static library does not include the hidden_deps because this library object is used to generate the .pc file. Signed-off-by: Thomas Monjalon --- doc/guides/contributing/coding_style.rst | 6 ++++++ drivers/meson.build | 9 ++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/doc/guides/contributing/coding_style.rst b/doc/guides/contributing/coding_style.rst index 841ef6d5c8..c96457273f 100644 --- a/doc/guides/contributing/coding_style.rst +++ b/doc/guides/contributing/coding_style.rst @@ -975,6 +975,12 @@ deps ext_deps As above. +hidden_deps + **Default Value = []**. + Used to specify external dependencies, same as ``ext_deps``, except + the libraries won't be exposed as requirements of the static driver, + in the section ``Requires.private`` of the generated ``.pc`` file. + includes **Default Value = ** Some drivers include a base directory for additional source files and headers, so we have this diff --git a/drivers/meson.build b/drivers/meson.build index 29708cc2bb..759263c309 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -56,6 +56,7 @@ foreach class:dpdk_driver_classes # too, so that it can be reflected in the pkgconfig output for # static builds. ext_deps = [] + hidden_deps = [] pkgconfig_extra_libs = [] # pull in driver directory which should assign to each of the above @@ -71,8 +72,9 @@ foreach class:dpdk_driver_classes endforeach if build # get dependency objs from strings - shared_deps = ext_deps - static_deps = ext_deps + shared_deps = ext_deps + hidden_deps + static_deps = ext_deps + hidden_deps + static_pub_deps = ext_deps foreach d:deps if not is_variable('shared_rte_' + d) build = false @@ -82,6 +84,7 @@ foreach class:dpdk_driver_classes else shared_deps += [get_variable('shared_rte_' + d)] static_deps += [get_variable('static_rte_' + d)] + static_pub_deps += [get_variable('static_rte_' + d)] endif endforeach endif @@ -144,7 +147,7 @@ foreach class:dpdk_driver_classes sources, objects: objs, include_directories: includes, - dependencies: static_deps, + dependencies: static_pub_deps, # skip hidden_deps c_args: cflags, install: true) 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',