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 B33D8A0C55; Fri, 5 Nov 2021 15:58:32 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 571DD41134; Fri, 5 Nov 2021 15:58:32 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id CD9AE40E5A for ; Fri, 5 Nov 2021 15:58:30 +0100 (CET) X-IronPort-AV: E=McAfee;i="6200,9189,10158"; a="292744609" X-IronPort-AV: E=Sophos;i="5.87,212,1631602800"; d="scan'208";a="292744609" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Nov 2021 07:58:29 -0700 X-IronPort-AV: E=Sophos;i="5.87,212,1631602800"; d="scan'208";a="450591261" Received: from bricha3-mobl.ger.corp.intel.com ([10.252.3.73]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 05 Nov 2021 07:58:28 -0700 Date: Fri, 5 Nov 2021 14:58:24 +0000 From: Bruce Richardson To: Stephen Hemminger Cc: dev@dpdk.org Message-ID: 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-Disposition: inline In-Reply-To: <20211105000124.155788-1-stephen@networkplumber.org> 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 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.