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 18B3EA04B1; Thu, 5 Nov 2020 13:37:31 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 36476C31B; Thu, 5 Nov 2020 13:37:29 +0100 (CET) Received: from hqnvemgate25.nvidia.com (hqnvemgate25.nvidia.com [216.228.121.64]) by dpdk.org (Postfix) with ESMTP id CF5A0BE9B for ; Thu, 5 Nov 2020 13:37:27 +0100 (CET) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Thu, 05 Nov 2020 04:37:24 -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; Thu, 5 Nov 2020 12:37:19 +0000 From: Gregory Etelson To: CC: , , , , , , , , Date: Thu, 5 Nov 2020 14:37:03 +0200 Message-ID: <20201105123704.15791-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: 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=1604579844; bh=GqouB1mKVAmhhXYH1oEZj9fLR3RyNZWFpUT37Qk8NPI=; 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=mwRqGCsiEuyaeqX257C+0DXpfxP9yY6PfQP5a05GTiGbhGXkS67zKZdaxnOMMaTfo B4jdwzxMwPuDqrnYhqsXZcBd2Hx0ZQ7bYry972Kz9IVSXbDmgjlYsmjiq7RvugND0S n0aFdXgZvvkmfbbwOIooDWMElkFCxx3iDDJ2ENewc6j96kSu/AyRD2ETNoZS/rWegs 2M2QE305tihaYx2ZD5UkfhNE2s/VqjMMRohQeF2cKQ7KaSmIFDVVNYNsyldH/lbDtp N/NpOySaZtRNihjRMez67SUWpN1zU8f8AleeXXNIKMZsTwM0wzbmNt4AMa0Czpdfpm c7AxXgSl7z7Ew== Subject: [dpdk-dev] [PATCH v4] 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 | 29 +++++++++++++++++++++ doc/guides/linux_gsg/sys_reqs.rst | 5 ++++ 3 files changed, 45 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..f5479f999f --- /dev/null +++ b/buildtools/pkg-config/pkgconfig-validate.sh @@ -0,0 +1,29 @@ +#! /bin/sh +# SPDX-License-Identifier: BSD-3-Clause + +if [ "$#" -ne 1 ]; then + echo "$0: no pkg-config parameter" + exit 1 +fi +PKGCONF=3D"$1" + +# if pkgconf could not locate libdpdk.pc from existing PKG_CONFIG_PATH +# check meson template instead +# take the first located file +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}:$pc_dir" + +# Statically linked private DPDK objects of form +# -l:file.a must be positioned between --whole-archive =E2=80=A6 --no-whol= e-archive +# linker parameters. +# Old pkg-config versions misplace --no-whole-archive parameter and put it +# next to --whole-archive. +PKG_CONFIG_PATH=3D"$PKG_CONFIG_PATH" \ +"$PKGCONF" --libs --static libdpdk | \ +grep -q 'whole-archive.*l:lib.*no-whole-archive' +exit "$?" 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