From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6FC36A04E7; Mon, 2 Nov 2020 20:34:55 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D25532B93; Mon, 2 Nov 2020 20:34:53 +0100 (CET) Received: from hqnvemgate26.nvidia.com (hqnvemgate26.nvidia.com [216.228.121.65]) by dpdk.org (Postfix) with ESMTP id 935BB28EE for ; Mon, 2 Nov 2020 20:34:52 +0100 (CET) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Mon, 02 Nov 2020 11:34:54 -0800 Received: from nvidia.com (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 2 Nov 2020 19:34:43 +0000 From: Gregory Etelson To: CC: , , , , , , , , Date: Mon, 2 Nov 2020 21:34:26 +0200 Message-ID: <20201102193426.3295-1-getelson@nvidia.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201029091638.26646-1-getelson@nvidia.com> References: <20201029091638.26646-1-getelson@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1604345694; bh=Wt3UMLXYC488qoP3EaqZOxUuuZFMPCR0CB3ehvpB0nw=; h=From:To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Type:Content-Transfer-Encoding: X-Originating-IP:X-ClientProxiedBy; b=dnytlBzymvkkz6QPX6S7HM8hb+ztBNh4LLwnocs6j/wtMCtU0uDvR3/Cq1PQnoWT7 wYsmTLHWbp3CD2Kgg7KFJqii78yim60x5Kf5Jhcq8i431Nt8D7ANfcju+Bnp9d23rG JCck4dhxu3hKMTzl/lIs0Dl/eAO9vEf4pr2PqsuGS2VbHvUkn+YVxSLsO/e+XYWeYV xLjB0nYMcdn1j6839fCewTvdWdoVEmrgdF9FsMenPF/mvCqiznF8qmJ/565t41cyoA 82gljRLk/K9ZmACxE+yyiyLeP0JFAQ5FYkQkU/ZSgqqFrmZk5QvcFy4gMNBpwqXmE2 GrdFU8mKVrj3g== Subject: [dpdk-dev] [PATCH v3] build: add pkg-config validation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" 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. This patch validates host pkg-config utility and notifies about known issues. Signed-off-by: Gregory Etelson --- buildtools/pkg-config/meson.build | 11 ++++++ buildtools/pkg-config/pkgconfig-validate.sh | 43 +++++++++++++++++++++ doc/guides/linux_gsg/sys_reqs.rst | 5 +++ 3 files changed, 59 insertions(+) create mode 100755 buildtools/pkg-config/pkgconfig-validate.sh diff --git a/buildtools/pkg-config/meson.build b/buildtools/pkg-config/meso= n.build index 5f19304289..4f907d7638 100644 --- a/buildtools/pkg-config/meson.build +++ b/buildtools/pkg-config/meson.build @@ -53,3 +53,14 @@ This is required for a number of static inline functions= in the public headers.' # For static linking with dependencies as shared libraries, # the internal static libraries must be flagged explicitly. run_command(py3, 'set-static-linker-flags.py', check: true) + +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 diff --git a/buildtools/pkg-config/pkgconfig-validate.sh b/buildtools/pkg-c= onfig/pkgconfig-validate.sh new file mode 100755 index 0000000000..4b3bd2a9e3 --- /dev/null +++ b/buildtools/pkg-config/pkgconfig-validate.sh @@ -0,0 +1,43 @@ +#! /bin/sh +# SPDX-License-Identifier: BSD-3-Clause + +# Statically linked private DPDK objects of form +# -l:file.a must be positionned between --whole-archive =E2=80=A6 --no-who= le-archive +# linker parameters. +# Old pkg-config versions misplace --no-whole-archive parameter and put it +# next to --whole-archive. +test1_static_libs_order () { + PKG_CONFIG_PATH=3D"$PKG_CONFIG_PATH" \ + "$PKGCONF" --libs --static libdpdk | \ + grep -q 'whole-archive.*l:lib.*no-whole-archive' + if test "$?" -ne 0 ; then + echo "WARNING: invalid static libraries order" + ret=3D1 + fi + return $ret +} + +if [ "$#" -ne 1 ]; then + echo "$0: no pkg-config parameter" + exit 1 +fi +PKGCONF=3D"$1" + +$PKGCONF --exists libdpdk +if [ $? -ne 0 ]; then + # pkgconf could not locate libdpdk.pc from existing PKG_CONFIG_PATH + # check meson template instead + pc_file=3D$(find "$MESON_BUILD_ROOT" -type f -name 'libdpdk.pc' -quit) + 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}:$pc_dir" +fi + +ret=3D0 +test1_static_libs_order +if [ $ret -ne 0 ]; then + exit $ret +fi diff --git a/doc/guides/linux_gsg/sys_reqs.rst b/doc/guides/linux_gsg/sys_r= eqs.rst index 6ecdc04aa9..b67da05e13 100644 --- a/doc/guides/linux_gsg/sys_reqs.rst +++ b/doc/guides/linux_gsg/sys_reqs.rst @@ -60,6 +60,11 @@ Compilation of the DPDK =20 * Linux kernel headers or sources required to build kernel modules. =20 + +**Known Issues:** + +* pkg-config v0.27 supplied with RHEL-7 does not process correctly libdp= dk.pc Libs.private section. + .. note:: =20 Please ensure that the latest patches are applied to third party librar= ies --=20 2.28.0