[v3,3/4] net/mlx: fix library search in meson build

Message ID 20190418114903.42231-3-yskoh@mellanox.com (mailing list archive)
State Accepted, archived
Headers
Series [v3,1/4] drivers/event: disable octeontx for buggy compilers on arm64 |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Yongseok Koh April 18, 2019, 11:49 a.m. UTC
  If MLNX_OFED is installed, there's no .pc file installed for libraries and
dependency() can't find libraries by pkg-config. By adding fallback of
using cc.find_library(), libraries are properly located.

Fixes: e30b4e566f47 ("build: improve dependency handling")
Cc: bluca@debian.org
Cc: stable@dpdk.org

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---

v3:
* use lib name without 'lib' prefix for cc.find_library()

v2:
* change variable names to minimize code change

 drivers/net/mlx4/meson.build | 15 +++++++++------
 drivers/net/mlx5/meson.build | 15 +++++++++------
 2 files changed, 18 insertions(+), 12 deletions(-)
  

Comments

Luca Boccassi April 18, 2019, 12:02 p.m. UTC | #1
On Thu, 2019-04-18 at 04:49 -0700, Yongseok Koh wrote:
> If MLNX_OFED is installed, there's no .pc file installed for
> libraries and
> dependency() can't find libraries by pkg-config. By adding fallback
> of
> using cc.find_library(), libraries are properly located.
> 
> Fixes: e30b4e566f47 ("build: improve dependency handling")
> Cc: 
> bluca@debian.org
> 
> Cc: 
> stable@dpdk.org
> 
> 
> Signed-off-by: Yongseok Koh <
> yskoh@mellanox.com
> >
> ---
> 
> v3:
> * use lib name without 'lib' prefix for cc.find_library()
> 
> v2:
> * change variable names to minimize code change
> 
>  drivers/net/mlx4/meson.build | 15 +++++++++------
>  drivers/net/mlx5/meson.build | 15 +++++++++------
>  2 files changed, 18 insertions(+), 12 deletions(-)

Acked-by: Luca Boccassi <bluca@debian.org>
  

Patch

diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build
index de020701d1..2540489bb7 100644
--- a/drivers/net/mlx4/meson.build
+++ b/drivers/net/mlx4/meson.build
@@ -13,14 +13,17 @@  if pmd_dlopen
 		'-DMLX4_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
 	]
 endif
-libs = [
-	dependency('libmnl', required:false),
-	dependency('libmlx4', required:false),
-	dependency('libibverbs', required:false),
-]
+libnames = [ 'mnl', 'mlx4', 'ibverbs' ]
+libs = []
 build = true
-foreach lib:libs
+foreach libname:libnames
+	lib = dependency('lib' + libname, required:false)
 	if not lib.found()
+		lib = cc.find_library(libname, required:false)
+	endif
+	if lib.found()
+		libs += [ lib ]
+	else
 		build = false
 	endif
 endforeach
diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
index a4c684e1b5..1a65c3a989 100644
--- a/drivers/net/mlx5/meson.build
+++ b/drivers/net/mlx5/meson.build
@@ -13,14 +13,17 @@  if pmd_dlopen
 		'-DMLX5_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
 	]
 endif
-libs = [
-	dependency('libmnl', required:false),
-	dependency('libmlx5', required:false),
-	dependency('libibverbs', required:false),
-]
+libnames = [ 'mnl', 'mlx5', 'ibverbs' ]
+libs = []
 build = true
-foreach lib:libs
+foreach libname:libnames
+	lib = dependency('lib' + libname, required:false)
 	if not lib.found()
+		lib = cc.find_library(libname, required:false)
+	endif
+	if lib.found()
+		libs += [ lib ]
+	else
 		build = false
 	endif
 endforeach