From patchwork Thu Nov 5 12:37:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Gregory Etelson X-Patchwork-Id: 83724 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org 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 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 Acked-by: Bruce Richardson --- 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/meson.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 = 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 diff --git a/buildtools/pkg-config/pkgconfig-validate.sh b/buildtools/pkg-config/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="$1" + +# if pkgconf could not locate libdpdk.pc from existing PKG_CONFIG_PATH +# check meson template instead +# take the first located file +pc_file=$(find "$MESON_BUILD_ROOT" -type f -name 'libdpdk.pc' -print -quit) +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}:$pc_dir" + +# Statically linked private DPDK objects of form +# -l:file.a must be positioned between --whole-archive … --no-whole-archive +# linker parameters. +# Old pkg-config versions misplace --no-whole-archive parameter and put it +# next to --whole-archive. +PKG_CONFIG_PATH="$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_reqs.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 * Linux kernel headers or sources required to build kernel modules. + +**Known Issues:** + +* pkg-config v0.27 supplied with RHEL-7 does not process correctly libdpdk.pc Libs.private section. + .. note:: Please ensure that the latest patches are applied to third party libraries