patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 18.11 1/1] net/mlx: fix overlinking with meson and glue dlopen
@ 2020-12-10 21:21 Thomas Monjalon
  2020-12-11  9:45 ` Kevin Traynor
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Monjalon @ 2020-12-10 21:21 UTC (permalink / raw)
  To: stable
  Cc: Bruce Richardson, Matan Azrad, Shahaf Shuler,
	Viacheslav Ovsiienko, Nelio Laranjeiro

[ upstream commit e21492a5175af31ae568fa5fabef1f4b22706962 ]

If enable_driver_mlx_glue=true, 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")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 buildtools/meson.build       | 2 ++
 drivers/net/mlx4/meson.build | 8 +++++++-
 drivers/net/mlx5/meson.build | 9 ++++++++-
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/buildtools/meson.build b/buildtools/meson.build
index cdd38ed24e..7e06445d89 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -1,6 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
+pkgconf = find_program('pkg-config', 'pkgconf', required: false)
+
 subdir('pmdinfogen')
 
 pmdinfo = find_program('gen-pmdinfo-cfile.sh')
diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build
index ebad30a04a..a6837bc823 100644
--- a/drivers/net/mlx4/meson.build
+++ b/drivers/net/mlx4/meson.build
@@ -28,12 +28,18 @@ libs = [
 foreach lib:libs
 	if not lib.found()
 		build = false
+	elif not pmd_dlopen
+		ext_deps += lib
 	endif
 endforeach
+if pmd_dlopen
+	# Build without adding shared libs to Libs.private
+	ibv_cflags = run_command(pkgconf, '--cflags', 'libibverbs').stdout()
+	ext_deps += declare_dependency(compile_args: ibv_cflags.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 87b267a254..34759c7dbc 100644
--- a/drivers/net/mlx5/meson.build
+++ b/drivers/net/mlx5/meson.build
@@ -29,12 +29,19 @@ libs = [
 foreach lib:libs
 	if not lib.found()
 		build = false
+	elif not pmd_dlopen
+		ext_deps += lib
 	endif
 endforeach
+if pmd_dlopen
+	ext_deps += libs[0] # libmnl
+	# Build without adding ibverbs libs to Libs.private
+	ibv_cflags = run_command(pkgconf, '--cflags', 'libibverbs').stdout()
+	ext_deps += declare_dependency(compile_args: ibv_cflags.split())
+endif
 
 if build
 	allow_experimental_apis = true
-	ext_deps += libs
 	sources = files(
 		'mlx5.c',
 		'mlx5_ethdev.c',
-- 
2.29.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-11  9:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-10 21:21 [dpdk-stable] [PATCH 18.11 1/1] net/mlx: fix overlinking with meson and glue dlopen Thomas Monjalon
2020-12-11  9:45 ` Kevin Traynor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).