net/mlx: fix overlinking with meson and glue dlopen
authorThomas Monjalon <thomas@monjalon.net>
Wed, 12 Feb 2020 22:07:08 +0000 (23:07 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 14 Feb 2020 11:42:13 +0000 (12:42 +0100)
If ibverbs_link is dlopen, 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")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
drivers/common/mlx5/meson.build
drivers/net/mlx4/meson.build

index ea98e61..141739f 100644 (file)
@@ -29,7 +29,7 @@ foreach libname:libnames
        endif
        if lib.found()
                libs += lib
-               if not static_ibverbs
+               if not static_ibverbs and not dlopen_ibverbs
                        ext_deps += lib
                endif
        else
@@ -38,10 +38,12 @@ foreach libname:libnames
                subdir_done()
        endif
 endforeach
-if static_ibverbs
+if static_ibverbs or dlopen_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())
+endif
+if static_ibverbs
        # 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())
index f66e70f..c598745 100644 (file)
@@ -30,7 +30,7 @@ foreach libname:libnames
        endif
        if lib.found()
                libs += lib
-               if not static_ibverbs
+               if not static_ibverbs and not dlopen_ibverbs
                        ext_deps += lib
                endif
        else
@@ -39,10 +39,12 @@ foreach libname:libnames
                subdir_done()
        endif
 endforeach
-if static_ibverbs
+if static_ibverbs or dlopen_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())
+endif
+if static_ibverbs
        # 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())