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 5213DA04B5; Thu, 29 Oct 2020 10:17:05 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C4412C826; Thu, 29 Oct 2020 10:17:02 +0100 (CET) Received: from hqnvemgate24.nvidia.com (hqnvemgate24.nvidia.com [216.228.121.143]) by dpdk.org (Postfix) with ESMTP id 8EF43C81C for ; Thu, 29 Oct 2020 10:16:59 +0100 (CET) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Thu, 29 Oct 2020 02:17:03 -0700 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; Thu, 29 Oct 2020 09:16:52 +0000 From: Gregory Etelson To: CC: , , , , Bruce Richardson Date: Thu, 29 Oct 2020 11:16:38 +0200 Message-ID: <20201029091638.26646-1-getelson@nvidia.com> X-Mailer: git-send-email 2.28.0 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: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1603963023; bh=G/uC1dxc8bhA4dm6KwP6wSaV+uHtE+tlIHpInwA4OV4=; h=From:To:CC:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Type:Content-Transfer-Encoding:X-Originating-IP: X-ClientProxiedBy; b=sQrDYMbuSt5jIeWrf1Yqw2RI15J4u9WO/f7jdnTRCf7gSr4sC3FCEYzSwwTkLHiL+ qYn3ITvObrhONUEWEp/9ojws2cHGL13tjQy+7nc+20s4JbTjAfcVFYsMWWj1Iic/j5 Q5HjJVXyjVKje1fABPX28pwLTzcYVgVtvUI1/GMVRM7HaH7m2+gqeILDuWQVodnbqy 5iUV12l+MTAJgXeYuRy8a4ljQjMQK9EBUP7AQIzqgUhYp4Fr9NiQ91dCky2BBn31Ml g70PjoEw7E0N96U1/j6cElwtF0BOFzrc3vOMYXo+TJ1Cw8hJuyKKZ8Fvm362qN7apH Ml/1UNfwUiK0Q== Subject: [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 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 | 38 +++++++++++++++++++++ doc/guides/linux_gsg/sys_reqs.rst | 5 +++ 3 files changed, 54 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..57ee096988 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 \ No newline at end of file diff --git a/buildtools/pkg-config/pkgconfig-validate.sh b/buildtools/pkg-c= onfig/pkgconfig-validate.sh new file mode 100755 index 0000000000..b606bde908 --- /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 + +ret=3D0 +PKGCONF=3D"$1" + +# take the first result only +pc_file=3D$(find "$MESON_BUILD_ROOT" -type f -name 'libdpdk.pc' -print -qu= it) +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-who= le-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" +exit $ret 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