DPDK patches and discussions
 help / color / mirror / Atom feed
From: Gregory Etelson <getelson@nvidia.com>
To: NBU-Contact-Thomas Monjalon <thomas@monjalon.net>
Cc: "dev@dpdk.org" <dev@dpdk.org>, Matan Azrad <matan@nvidia.com>,
	"Raslan Darawsheh" <rasland@nvidia.com>,
	Bruce Richardson <bruce.richardson@intel.com>,
	"bluca@debian.org" <bluca@debian.org>,
	"david.marchand@redhat.com" <david.marchand@redhat.com>,
	Christian Ehrhardt <christian.ehrhardt@canonical.com>,
	"ktraynor@redhat.com" <ktraynor@redhat.com>
Subject: Re: [dpdk-dev] [PATCH] build: add pkg-config validation
Date: Sun, 1 Nov 2020 12:06:01 +0000	[thread overview]
Message-ID: <MN2PR12MB4800BE1BB379BA32DA67E8BFA5130@MN2PR12MB4800.namprd12.prod.outlook.com> (raw)
In-Reply-To: <2238546.UhOg32N8m0@thomas>

Hello Thomas,

> -----Original Message-----
> 
> 29/10/2020 10:16, Gregory Etelson:
> > DPDK relies on pkg-config(1) to provide correct parameters for
> > compiler and linker used in application build.
> > Inaccurate build parameters, produced by pkg-config from DPDK .pc
> > files could fail application build or cause unpredicted results during
> > application runtime.
> 
> Actually this is only for static linkage of examples with makefiles.
>

In our case, pkg-config produced wrong output for statically linked
external application.
General case of error in pkg-config output can lead to any kind of build
or execution fault. 
 
> > This patch validates host pkg-config utility and notifies about known
> > issues.
> >
> > Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> > ---
> > --- a/buildtools/pkg-config/meson.build
> > +++ b/buildtools/pkg-config/meson.build
> > +pkgconf = find_program('pkg-config', 'pkgconf', required: false) if
> > +(pkgconf.found())
> > +     cmd = run_command('./pkgconfig-validate.sh', pkgconf.path(),
> > +                        check:false)
> > +     if cmd.returncode() != 0
> > +             version = run_command(pkgconf, '--version')
> > +             warning('invalid pkg-config version @0@'.format(
> > +                     version.stdout().strip()))
> > +     endif
> > +endif
> 
> Should we restrict this warning to the example makefiles?
>

If DPDK build infrastructure detects wrong pkg-config, it must
notify all applications, internal and external, about the
potential build fault.
 
> 
> > --- /dev/null
> > +++ b/buildtools/pkg-config/pkgconfig-validate.sh
> > @@ -0,0 +1,38 @@
> > +#! /bin/sh
> > +# SPDX-License-Identifier: BSD-3-Clause
> > +
> > +if [ "$#" -ne 1 ]; then
> > +     echo "$0: no pkg-config parameter"
> > +     exit 1
> > +fi
> 
> The default pkg-config from path could considered.
> 

Host can use ether pkg-config or pkgconf utility for
build configuration. The script let the meson build
system to query host what exact utility is used.
Meson passes the query result to the validation script. 

> > +
> > +ret=0
> > +PKGCONF="$1"
> 
> PKGCONF=${1:-pkg-config}
> 

Please see above.

> > +
> > +# take the first result only
> > +pc_file=$(find "$MESON_BUILD_ROOT" -type f -name 'libdpdk.pc' -print
> > +-quit)
> 
> It does not look in PKG_CONFIG_PATH.
>

Meson stores libdpdk.pc template under MESON_BUILD_ROOT. That template has enough
information to run validation queries.
 
> > +if [ ! -f "$pc_file" ]; then
> > +     echo "$0: cannot locate libdpdk.pc"
> > +     exit 1
> > +fi
> > +
> > +pc_dir=$(dirname "$pc_file")
> > +__pkg_config_path="$PKG_CONFIG_PATH"
> > +PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:$pc_dir"
> > +export PKG_CONFIG_PATH
> > +
> > +# Statically linked private DPDK objects of form # -l:file.a must be
> > +positionned between --whole-archive … --no-whole-archive # linker
> > +parameters.
> > +# Old pkg-config versions misplace --no-whole-archive parameter and
> > +put it # next to --whole-archive.
> > +"$PKGCONF" --libs --static libdpdk | \ grep -q
> > +'whole-archive.*l:lib.*no-whole-archive'
> > +if test "$?" -ne 0 ; then
> > +     echo "WARNING: invalid pkg-config"
> > +     ret=1
> > +fi
> > +
> > +# restore PKG_CONFIG_PATH
> > +export PKG_CONFIG_PATH="$__pkg_config_path"
> 
> Instead of restoring, you could just set the variable on the command line
> calling PKGCONF.

Not sure I understand what did mean here.

> 
> > +exit $ret
> 
> 
> > --- a/doc/guides/linux_gsg/sys_reqs.rst
> > +++ b/doc/guides/linux_gsg/sys_reqs.rst
> > +**Known Issues:**
> > +
> > +*   pkg-config v0.27 supplied with RHEL-7 does not process correctly
> libdpdk.pc Libs.private section.
> 
> Is it only the RHEL version or all 0.27 packages?
> 
> Is it enough to warn on issue, or do we prefer recommend a minimal
> version?
> 

We can both warn about pkg-config versions with known issues and validate
host configuration utility during run-time.
   



  reply	other threads:[~2020-11-01 12:06 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-29  9:16 Gregory Etelson
2020-11-01 10:01 ` Thomas Monjalon
2020-11-01 12:06   ` Gregory Etelson [this message]
2020-11-02  6:45 ` [dpdk-dev] [PATCH v2] " Gregory Etelson
2020-11-02 12:11   ` Bruce Richardson
2020-11-02 19:39     ` Gregory Etelson
2020-11-02 19:34 ` [dpdk-dev] [PATCH v3] " Gregory Etelson
2020-11-03 10:09   ` Bruce Richardson
2020-11-04  8:38     ` Gregory Etelson
2020-11-05 12:37 ` [dpdk-dev] [PATCH v4] " Gregory Etelson
2020-11-05 13:17   ` Bruce Richardson
2020-11-13 13:38   ` David Marchand
2020-11-13 15:16     ` Gregory Etelson
2020-11-13 15:32       ` David Marchand
2020-11-17 18:17 ` [dpdk-dev] [PATCH] doc: notify bug in pkg-config v0.27 Gregory Etelson
2020-11-26 15:42   ` [dpdk-dev] [PATCH v2 1/1] doc: add pkg-config requirement for applications Thomas Monjalon
2020-11-26 16:24     ` Bruce Richardson
2020-11-26 16:38       ` Thomas Monjalon
2020-11-26 16:43   ` [dpdk-dev] [PATCH v3 " Thomas Monjalon
2020-11-26 16:46     ` Bruce Richardson
2020-11-27  0:59       ` 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=MN2PR12MB4800BE1BB379BA32DA67E8BFA5130@MN2PR12MB4800.namprd12.prod.outlook.com \
    --to=getelson@nvidia.com \
    --cc=bluca@debian.org \
    --cc=bruce.richardson@intel.com \
    --cc=christian.ehrhardt@canonical.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=ktraynor@redhat.com \
    --cc=matan@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=thomas@monjalon.net \
    /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).