DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] build: allow build DPDK as a meson submodule
Date: Fri, 5 Nov 2021 09:17:14 -0700	[thread overview]
Message-ID: <20211105091714.22f032f2@hermes.local> (raw)
In-Reply-To: <YYVGkOEg/q+6HDun@bricha3-MOBL.ger.corp.intel.com>

On Fri, 5 Nov 2021 14:58:24 +0000
Bruce Richardson <bruce.richardson@intel.com> wrote:

> On Thu, Nov 04, 2021 at 05:01:24PM -0700, Stephen Hemminger wrote:
> > Some other projects using meson may not be able to use DPDK
> > using the standard distribution pkg-config mechanism.
> > Meson supports a way to handle this via the subproject
> >   https://mesonbuild.com/Subprojects.html
> > 
> > This patch adds the necessary dependency to follow the
> > "Naming convention for dependency variables" from the documentation.
> > 
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > ---
> > Cleaned up from RFC and support both static and shared.
> > 
> >  lib/meson.build |  5 +++++
> >  meson.build     | 12 ++++++++++++
> >  2 files changed, 17 insertions(+)
> > 
> > diff --git a/lib/meson.build b/lib/meson.build
> > index 499d26060fdd..e6df538bd6ef 100644
> > --- a/lib/meson.build
> > +++ b/lib/meson.build
> > @@ -241,6 +241,11 @@ foreach l:libraries
> >  
> >      dpdk_libraries = [shared_lib] + dpdk_libraries
> >      dpdk_static_libraries = [static_lib] + dpdk_static_libraries
> > +    if get_option('default_library') == 'static'
> > +        dpdk_libs_deps += static_dep
> > +    else
> > +        dpdk_libs_deps += shared_dep
> > +    endif
> >  
> >      set_variable('shared_rte_' + name, shared_dep)
> >      set_variable('static_rte_' + name, static_dep)
> > diff --git a/meson.build b/meson.build
> > index 12cb6e0e83f3..032783e4e6cf 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -36,6 +36,7 @@ dpdk_drivers = []
> >  dpdk_extra_ldflags = []
> >  dpdk_libs_disabled = []
> >  dpdk_drvs_disabled = []
> > +dpdk_libs_deps = []
> >  abi_version_file = files('ABI_VERSION')
> >  
> >  if host_machine.cpu_family().startswith('x86')
> > @@ -97,6 +98,17 @@ configure_file(output: build_cfg,
> >  # build pkg-config files for dpdk
> >  subdir('buildtools/pkg-config')
> >  
> > +# If DPDK is being built as subproject then define
> > +# variable with the dependency convention
> > +if meson.is_subproject()
> > +    libdpdk_dep = declare_dependency(
> > +        version: meson.project_version(),
> > +        compile_args : pkg_extra_cflags,
> > +        dependencies: dpdk_libs_deps,
> > +        link_args: dpdk_extra_ldflags,
> > +    )
> > +endif
> > +  
> 
> While the code all looks correct to me, when I tested it out, the resulting
> app couldn't link. I tested by moving l2fwd/main.c to a new folder and
> adding the following as a meson.build file in it:
> 
>   project('l2fwd', 'C')
> 
>   dpdk_dep = dependency('libdpdk', fallback : ['libdpdk', 'libdpdk_dep'])
>   executable('dpdk-l2fwd', 'main.c',
>           dependencies: dpdk_dep)
> 
> Even though dependencies should include both the libs to link with and the
> include paths, that didn't seem to work in this case - the compile worked
> fine with all cflags present, none of the DPDK libraries were given on the
> link command - just the extra -ldl etc. args.
> Adding "link_with: dpdk_libraries" fixed this and allowed it work for me,
> but I'm surpised that it proved necessary. Stephen, does it work for you
> with just the dependencies provided?
> 
> /Bruce
> 
> PS: My testing was done with meson 0.56.2 on Ubuntu 21.10.

I was testing with a cross-build with an app that uses quite limited
dependencies, and it worked. Also, the app has same depedencies for some
of the parts that are missed.

Will try l3fwd and something more complex for next version

  reply	other threads:[~2021-11-05 16:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-03 22:12 [dpdk-dev] [RFC] " Stephen Hemminger
2021-11-04  8:59 ` Bruce Richardson
2021-11-05  0:01 ` [dpdk-dev] [PATCH] " Stephen Hemminger
2021-11-05 14:58   ` Bruce Richardson
2021-11-05 16:17     ` Stephen Hemminger [this message]
2021-11-05 17:22 ` [dpdk-dev] [PATCH v2] build: add definitions for use as meson subproject Stephen Hemminger
2021-11-05 18:11   ` Bruce Richardson
2022-02-02 20:59     ` Thomas Monjalon
2022-05-06 14:06   ` Bruce Richardson
2022-05-06 14:43 ` [PATCH v3] " Bruce Richardson
2022-05-21  0:54   ` Ben Magistro
2022-06-07 16:05     ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211105091714.22f032f2@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).