[dpdk-stable] patch 'net/mlx: workaround static linkage with meson' has been queued to stable release 19.11.1

luca.boccassi at gmail.com luca.boccassi at gmail.com
Mon Feb 17 18:45:27 CET 2020


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 <thomas at monjalon.net>
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 <thomas at monjalon.net>
Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
---
 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 <thomas at monjalon.net>
 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 <thomas at monjalon.net>
 Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
 ---
- 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
 


More information about the stable mailing list