From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 51C0CA0C55; Fri, 5 Nov 2021 17:17:40 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1C39640E5A; Fri, 5 Nov 2021 17:17:40 +0100 (CET) Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by mails.dpdk.org (Postfix) with ESMTP id 4AA0240689 for ; Fri, 5 Nov 2021 17:17:39 +0100 (CET) Received: by mail-pj1-f47.google.com with SMTP id fv9-20020a17090b0e8900b001a6a5ab1392so3726981pjb.1 for ; Fri, 05 Nov 2021 09:17:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YrKi9HhA11AD0obYgNEqHGjbBlgUnoaYBW+y2NH+Y9g=; b=tF60pf/XoAt203fM1GGZ/f5L3fG5VVIFDU8bwRhxGbIZlEMMBdwMMnWwBchtIXsuKp iYGakeMKVVC8p8d3SLPMZTN5jdXsH5nzUX1/eoC4XYB/LiUm3dLg007Aoy0wtfh7gU9L FmcS9S209WF8dQ0F5K/4X6oh1yqIFbmJeVSUD319kdJbNHBq5CH73CxF8+xDUJkCv7og DhO+44159DpHkYlz2EkNh+8bZ33OTa1B6RfEyM5OcVLc+XZHn1i4WrqJoXOVX7JuhhqX rJeobdh+j5r7IEPDuDHck4cDarYUNJ755E19AT6I4HxnElP0uTKKnxVeo1JonpoeCW2J Sv0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YrKi9HhA11AD0obYgNEqHGjbBlgUnoaYBW+y2NH+Y9g=; b=pS0jbc1qZJ1sj8v4pizXOybszwwG6YCLreRf1xKmXocRipc6uDqr7lEq7duiLieRBL Tt3N8iEVVnRJQqMtJi4EsPKlyaHnXY2AYwLDxwtxrMGvlikpRZAIVgtfQB43VRnWBXa8 jpbvdUkjBcNp/ulh8Xrb3o3sAJKsfbSpZF3AfVas/w8/7B0BhgVaktUx5qEtgDxafHX2 nJIxHzR3o7hiWSQQekgYsr6J+//WumfM0sLf6DmNhJPuD3Q37ax4g1sgS2RQbaKWOuac X7PgktsZnNbQ1lTToAQTZ9SOpdDWlDHQviBnmp+u05t7XPZtd4flLyLiCl0vD9xatrZu zQLQ== X-Gm-Message-State: AOAM531iP4fovc3yPGUnzbV/MRVnUdLtTHr60FFfHLRBdt6+Wn/QZ5vN jeyFkA4JVYffbtVmb3mgyfa4f7/Zvvy7AA== X-Google-Smtp-Source: ABdhPJyL27SUkg6XgLlNwySm2qRoEFCWTAEumVmjn7Dn8RSYcAmaelnAZEMTRSfmxqDGtvmMcCXqOg== X-Received: by 2002:a17:90b:4c88:: with SMTP id my8mr11926390pjb.132.1636129058433; Fri, 05 Nov 2021 09:17:38 -0700 (PDT) Received: from hermes.local (204-195-33-123.wavecable.com. [204.195.33.123]) by smtp.gmail.com with ESMTPSA id k6sm8009434pfu.48.2021.11.05.09.17.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Nov 2021 09:17:38 -0700 (PDT) Date: Fri, 5 Nov 2021 09:17:14 -0700 From: Stephen Hemminger To: Bruce Richardson Cc: dev@dpdk.org Message-ID: <20211105091714.22f032f2@hermes.local> In-Reply-To: References: <20211103221205.63175-1-stephen@networkplumber.org> <20211105000124.155788-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] build: allow build DPDK as a meson submodule X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Fri, 5 Nov 2021 14:58:24 +0000 Bruce Richardson 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 > > --- > > 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