From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 4C2BEA04B5;
	Sun,  1 Nov 2020 11:01:26 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 625B8AAB7;
	Sun,  1 Nov 2020 11:01:24 +0100 (CET)
Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com
 [64.147.123.19]) by dpdk.org (Postfix) with ESMTP id 127E6AA06
 for <dev@dpdk.org>; Sun,  1 Nov 2020 11:01:22 +0100 (CET)
Received: from compute2.internal (compute2.nyi.internal [10.202.2.42])
 by mailout.west.internal (Postfix) with ESMTP id 6605A59D;
 Sun,  1 Nov 2020 05:01:19 -0500 (EST)
Received: from mailfrontend1 ([10.202.2.162])
 by compute2.internal (MEProxy); Sun, 01 Nov 2020 05:01:20 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding:content-type; s=fm2; bh=
 0sUtGoH8JNvm6uvHjFiOfXMMVxH+rHAkW4gbg0+gwXA=; b=Fl9aUpac1X12UNmQ
 lGJzxb1np7JGsfcVGnzKSkcTrQ2bdMDSr56p75+OixyWj4gDSS+HvAabJBlK+cR4
 +8IeOccdIAq8XlZQhAjkDZftblV9xuvIayFiAPrEMnwirB96z83jbf0mZyqfyjK5
 Rft1KiqdYgWLk9vvz7CvxFqWRKun3Ic0/Xxk+dwCKBbueDmaXt9uthB3Hu94vzwR
 Tlrb1PME6Za7wT+TRCj6vH0RbZykFKnzDY4utLksDLklBEhcA712IybZBC2h7Hk/
 /QfBcXg6Ghl9eH+tZ5ZjMZ2PIDYo88Ax9UV/JqTVuPsYdZahsLvVpTpy/nVnosR3
 ctfMag==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:content-type
 :date:from:in-reply-to:message-id:mime-version:references
 :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender
 :x-sasl-enc; s=fm1; bh=0sUtGoH8JNvm6uvHjFiOfXMMVxH+rHAkW4gbg0+gw
 XA=; b=XY37WQZB52+S72s1iKQW8Drm5LO0IytrObodGEw0J7DQAvNypjpQSEWRK
 UqAk4PRz8+qrxF0VRrfPbNkmuDTYp/payPVKDSyEfw0lvnfMc7+BF0P4IKqbLrSH
 nMqzI4tWOC2DWP/2XIwoCz+4PMUz59UZgsM+BdpG3tH8V7BXJSWJMevBcDp1NH2S
 MR9NyramWxH3x8fmKB6dduiV6upHqPYLbTa7Em2twEB1XK+M90zKBQLAVEiE16i8
 hR7Jjl91xGPGHU7i8LaH78fNeNHCsSqrB1yU93w9czwiAeAGH/tTouIdvdKuFGgZ
 i902EAj1HZAu1vrTNX28bgMGUrtHA==
X-ME-Sender: <xms:boeeX-oy6V10eLvWeeT2GQbcCroKiSXK_vXuS2ok62RTiSkFjiemHg>
 <xme:boeeX8oFt6MWfm-R89rTP9o5UHuDFcfjeHH6B3cUV3uIOmIPgR8FhsbwFhdeHZ_tn
 LvBdQq0LBeEdb6cMg>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleelgdduvdcutefuodetggdotefrodftvf
 curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu
 uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc
 fjughrpefhvffufffkjghfggfgtgesthhqredttddtjeenucfhrhhomhepvfhhohhmrghs
 ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf
 frrghtthgvrhhnpeekteehtdeivefhieegjeelgedufeejheekkeetueevieeuvdevuedt
 jeevheevteenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih
 iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho
 nhdrnhgvth
X-ME-Proxy: <xmx:boeeXzNLuZ0mSdBenaqVKYUXBKeh_QFpG5pCVs5z5SX5tUWOqzOhLQ>
 <xmx:boeeX95CXHNEyX0ATF8kL90kpBC_Me5uhsBvByUAKKDEuzXIew4jZQ>
 <xmx:boeeX96wR2fP-ABmwtkVpyjSLOutixKGJLJD8yujTQbT9UQ9tfFeJQ>
 <xmx:b4eeX6smEShUjMhfp18L69ucGtpABW-h9cut5zo9sukq53evhNfugw>
Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184])
 by mail.messagingengine.com (Postfix) with ESMTPA id 36EEA3280060;
 Sun,  1 Nov 2020 05:01:17 -0500 (EST)
From: Thomas Monjalon <thomas@monjalon.net>
To: Gregory Etelson <getelson@nvidia.com>
Cc: dev@dpdk.org, matan@nvidia.com, rasland@nvidia.com,
 Bruce Richardson <bruce.richardson@intel.com>, bluca@debian.org,
 david.marchand@redhat.com,
 Christian Ehrhardt <christian.ehrhardt@canonical.com>, ktraynor@redhat.com
Date: Sun, 01 Nov 2020 11:01:16 +0100
Message-ID: <2238546.UhOg32N8m0@thomas>
In-Reply-To: <20201029091638.26646-1-getelson@nvidia.com>
References: <20201029091638.26646-1-getelson@nvidia.com>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="UTF-8"
Subject: Re: [dpdk-dev] [PATCH] build: add pkg-config validation
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

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.

> This patch validates host pkg-config utility and notifies about
> known issues.
>=20
> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> ---
> --- a/buildtools/pkg-config/meson.build
> +++ b/buildtools/pkg-config/meson.build
> +pkgconf =3D find_program('pkg-config', 'pkgconf', required: false)
> +if (pkgconf.found())
> +	cmd =3D run_command('./pkgconfig-validate.sh', pkgconf.path(),
> +			   check:false)
> +	if cmd.returncode() !=3D 0
> +		version =3D 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?


> --- /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.

> +
> +ret=3D0
> +PKGCONF=3D"$1"

PKGCONF=3D${1:-pkg-config}

> +
> +# take the first result only
> +pc_file=3D$(find "$MESON_BUILD_ROOT" -type f -name 'libdpdk.pc' -print -=
quit)

It does not look in PKG_CONFIG_PATH.

> +if [ ! -f "$pc_file" ]; then
> +	echo "$0: cannot locate libdpdk.pc"
> +	exit 1
> +fi
> +
> +pc_dir=3D$(dirname "$pc_file")
> +__pkg_config_path=3D"$PKG_CONFIG_PATH"
> +PKG_CONFIG_PATH=3D"${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 =E2=80=A6 --no-w=
hole-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=3D1
> +fi
> +
> +# restore PKG_CONFIG_PATH
> +export PKG_CONFIG_PATH=3D"$__pkg_config_path"

Instead of restoring, you could just set the variable on the
command line calling PKGCONF.

> +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 lib=
dpdk.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?