[dpdk-dev] [PATCH v2 0/4] add static ibverbs in meson

Bruce Richardson bruce.richardson at intel.com
Tue Feb 4 12:48:38 CET 2020


On Mon, Jan 27, 2020 at 04:43:58PM +0100, Thomas Monjalon wrote:
> This is the follow-up of the feature I added one year ago:
> static linkage of libibverbs in mlx PMDs.
> The first implementation was focused on "make".
> This second round does the same with "meson".
> 
> 
> changes in v2:
> - split mlx patch for normal addition and workarounds
> - fix ldflags for ibverbs installed in a standard directory
> - fix libs order leading to undefined references
> - add doc for hidden_deps
> - improve explanations in commit logs
> 
> 
> Thomas Monjalon (4):
>   net/mlx: add static ibverbs linkage with meson
>   buildtools: get static mlx dependencies for meson
>   build: allow hiding dependencies from pkg-config
>   net/mlx: workaround static linkage with meson
> 
> 
Hi Thomas,

as we discussed offline, I really don't like the necessity of the
hidden_deps part of this, so I've tried coming up with some other
solutions. For example, in my testing I get the same result with the
following diff instead of the second two patches (just showing for mlx5 -
changes for mlx4 are identical):

--- a/drivers/net/mlx5/meson.build
+++ b/drivers/net/mlx5/meson.build
@@ -31,10 +31,7 @@ foreach libname:libnames
        endif
        if lib.found()
                libs += lib
-               if static_ibverbs
-                       # Build without adding shared libs to Requires.private
-                       hidden_deps += lib.partial_dependency(compile_args:true)
-               else
+               if not static_ibverbs
                        ext_deps += lib
                endif
        else
@@ -44,8 +41,10 @@ foreach libname:libnames
 endforeach
 if build and static_ibverbs
        # Add static deps ldflags to internal apps and Libs.private
-       ldflags = run_command(ldflags_ibverbs_static, check:true).stdout()
-       ext_deps += declare_dependency(link_args:ldflags.split())
+       ibv_ldflags = run_command(ldflags_ibverbs_static, check:true).stdout()
+       ibv_cflags = run_command(find_program('pkg-config'), '--cflags', 'libibverbs').stdout()
+       ext_deps += declare_dependency(compile_args: ibv_cflags.split(),
+                               link_args:ibv_ldflags.split())
 endif
 
 if build


By doing things this way - assuming it works in your tests too - we avoid
any need to change anything in the common drivers code.

How I tested this was by:
* doing a local rdma-core build as described in the docs and exporting
  PKG_CONFIG_PATH to point to the .pc file
* doing builds with all 4 of your patches applied (one static linking of
  apps, one shared, just in case)
* doing builds with the first two patches and the above diff.
* compare the meson.build files and libdpdk.pc files for the two cases. In
  my tests the second case as additional -I flags, but otherwise identical.

Regards,
/Bruce


More information about the dev mailing list