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 4F54AA0553 for ; Mon, 17 Feb 2020 18:46:49 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 48E2E1DA12; Mon, 17 Feb 2020 18:46:49 +0100 (CET) Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by dpdk.org (Postfix) with ESMTP id 3276B1DAB4 for ; Mon, 17 Feb 2020 18:46:48 +0100 (CET) Received: by mail-wm1-f68.google.com with SMTP id a5so205270wmb.0 for ; Mon, 17 Feb 2020 09:46:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jEudLjQhzY93iZhZiSrgUNMVzuZv5xz5xgFmZywFde0=; b=GbflgfIx/YiFHoOlIl+XUuKVQf9XYhkn2i1KogvxeQTBd3qURgtxLd9LK2dWFl1M/n tIx9m56qwdZoYNfEsUgihqeMwzfaUxz8uAWtbjDMaUyw3aeIdZITQ8FtxmZTYnccqHK9 PB7fIOsUqBC1lDgAQIKcF8pWIJ2My/I+2C+tSahUkX1Wlu0gMEVlhtftYJtWO9iJvy4l 8f+9oHNLYPbgg/9/ddxlfuIqABPxXDMl0XBaxODx7zA/GvCTt+JoPXpz9lmCabpE8Vvx LzkqmqR9JAxwQcklYweTBGNKn3B+qAIeSDDTrOqd6wxivHqXbgQObWeXQ2wPsp8FlL4Q zwvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jEudLjQhzY93iZhZiSrgUNMVzuZv5xz5xgFmZywFde0=; b=tJPPMVUlDUHS7Fy8Cl4ZGNrXDCrqIh0dX52sKGp9Xknlm2Uen6BfLZYhonyRPytKZa /pEUwqGGKHuwo7DZoECZ5+XzCMqzdU/9C7ragkzccD7mDZpIVKbqmQLOqqmbbvqWKKby Sbc109j5z37tw0aieBV4BzZcm0VBqljg/bGXLtHRS+lIq3f8gCgdE11roH9/9cB5AHhS +kvJh6Aqm/pG1hC+KD9KyQtrSa3s9V3ouCGHrxDLMUiqneo0jBg5WD8yz4Jc/O6Q5cMH TqvzLJipRLPMPa3/bcEkMymp+/QZuN2RaRU4LPBoOIhaxnwycFj2hT6K47dMcCNtAzIT x/wA== X-Gm-Message-State: APjAAAUIvLLRvV2W0SFxpILf0L+zBA4F8iN6oPx+JKhnEN53E95eCOR5 SW7mFRUteH2eSUO2tsANoak= X-Google-Smtp-Source: APXvYqwyE++3ZiSY0dENzv1MSHfxOuhoxvIVRX1nH8GJcqzvRuGcf6+vTQGqPYWV2NYqg5r7Q8vK9A== X-Received: by 2002:a1c:488a:: with SMTP id v132mr131823wma.153.1581961607839; Mon, 17 Feb 2020 09:46:47 -0800 (PST) Received: from localhost (userh634.uk.uudial.com. [194.69.103.7]) by smtp.gmail.com with ESMTPSA id c13sm2175101wrn.46.2020.02.17.09.46.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2020 09:46:47 -0800 (PST) From: luca.boccassi@gmail.com To: Thomas Monjalon Cc: Bruce Richardson , dpdk stable Date: Mon, 17 Feb 2020 17:45:27 +0000 Message-Id: <20200217174546.25334-35-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200217174546.25334-1-luca.boccassi@gmail.com> References: <20200211112216.3929-190-luca.boccassi@gmail.com> <20200217174546.25334-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/mlx: workaround static linkage with meson' has been queued to stable release 19.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/19/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From 99641413e43afe32ca107ca4576a060fd91b5d98 Mon Sep 17 00:00:00 2001 From: Thomas Monjalon Date: Wed, 12 Feb 2020 23:07:06 +0100 Subject: [PATCH] net/mlx: workaround static linkage with meson [ upstream commit af331158f228aac12513abba13927a3745a41c14 ] 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: 6affeabaf321 ("net/mlx: add static ibverbs linkage with meson") Signed-off-by: Thomas Monjalon Signed-off-by: Bruce Richardson --- buildtools/meson.build | 2 ++ drivers/net/mlx4/meson.build | 14 ++++++++++++-- drivers/net/mlx5/meson.build | 13 ++++++++++++- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/buildtools/meson.build b/buildtools/meson.build index 6ef2c5721c..cd6f4c1af0 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') 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/net/mlx4/meson.build b/drivers/net/mlx4/meson.build index a87f439f59..17711f154b 100644 --- a/drivers/net/mlx4/meson.build +++ b/drivers/net/mlx4/meson.build @@ -30,7 +30,10 @@ 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 + '"' @@ -38,8 +41,15 @@ foreach libname:libnames endforeach if build + 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', diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build index 6f2a0ad5a5..e21f3d8dc8 100644 --- a/drivers/net/mlx5/meson.build +++ b/drivers/net/mlx5/meson.build @@ -31,6 +31,9 @@ foreach libname:libnames endif if lib.found() libs += [ lib ] + if not static_ibverbs + ext_deps += lib + endif else build = false reason = 'missing dependency, "' + libname + '"' @@ -38,9 +41,17 @@ foreach libname:libnames endforeach if build + 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 allow_experimental_apis = true deps += ['hash'] - ext_deps += libs sources = files( 'mlx5.c', 'mlx5_ethdev.c', -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-02-17 17:00:16.297040760 +0000 +++ 0035-net-mlx-workaround-static-linkage-with-meson.patch 2020-02-17 17:00:15.355951135 +0000 @@ -1,8 +1,10 @@ -From af331158f228aac12513abba13927a3745a41c14 Mon Sep 17 00:00:00 2001 +From 99641413e43afe32ca107ca4576a060fd91b5d98 Mon Sep 17 00:00:00 2001 From: Thomas Monjalon Date: Wed, 12 Feb 2020 23:07:06 +0100 Subject: [PATCH] net/mlx: workaround static linkage with meson +[ upstream commit af331158f228aac12513abba13927a3745a41c14 ] + 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 @@ -30,13 +32,13 @@ 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(-) + buildtools/meson.build | 2 ++ + drivers/net/mlx4/meson.build | 14 ++++++++++++-- + drivers/net/mlx5/meson.build | 13 ++++++++++++- + 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/buildtools/meson.build b/buildtools/meson.build -index 0f563d89a3..9812917e50 100644 +index 6ef2c5721c..cd6f4c1af0 100644 --- a/buildtools/meson.build +++ b/buildtools/meson.build @@ -3,9 +3,11 @@ @@ -45,77 +47,78 @@ +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 206ef75ca2..089494e1f8 100644 ---- a/drivers/common/mlx5/meson.build -+++ b/drivers/common/mlx5/meson.build -@@ -29,16 +29,26 @@ foreach libname:libnames +diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build +index a87f439f59..17711f154b 100644 +--- a/drivers/net/mlx4/meson.build ++++ b/drivers/net/mlx4/meson.build +@@ -30,7 +30,10 @@ foreach libname:libnames + lib = cc.find_library(libname, required:false) endif if lib.found() - libs += lib +- libs += [ lib ] ++ libs += lib + if not static_ibverbs + ext_deps += lib + endif else build = false reason = 'missing dependency, "' + libname + '"' - subdir_done() - endif +@@ -38,8 +41,15 @@ foreach libname:libnames 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) + + if build ++ 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', +diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build +index 6f2a0ad5a5..e21f3d8dc8 100644 +--- a/drivers/net/mlx5/meson.build ++++ b/drivers/net/mlx5/meson.build +@@ -31,6 +31,9 @@ foreach libname:libnames endif if lib.found() -- libs += [ lib ] -+ libs += lib + libs += [ lib ] + if not static_ibverbs + ext_deps += lib + endif else build = false reason = 'missing dependency, "' + libname + '"' - subdir_done() - endif +@@ -38,9 +41,17 @@ foreach libname:libnames 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', + + if build ++ 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 + allow_experimental_apis = true + deps += ['hash'] +- ext_deps += libs + sources = files( + 'mlx5.c', + 'mlx5_ethdev.c', -- 2.20.1