DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] build: add pkg-config validation
@ 2020-10-29  9:16 Gregory Etelson
  2020-11-01 10:01 ` Thomas Monjalon
                   ` (4 more replies)
  0 siblings, 5 replies; 21+ messages in thread
From: Gregory Etelson @ 2020-10-29  9:16 UTC (permalink / raw)
  To: dev; +Cc: getelson, matan, rasland, thomas, Bruce Richardson

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 <getelson@nvidia.com>
---
 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/meson.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 = 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
\ No newline at end of file
diff --git a/buildtools/pkg-config/pkgconfig-validate.sh b/buildtools/pkg-config/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=0
+PKGCONF="$1"
+
+# take the first result only
+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"
+PKG_CONFIG_PATH="${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 … --no-whole-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=1
+fi
+
+# restore PKG_CONFIG_PATH
+export PKG_CONFIG_PATH="$__pkg_config_path"
+exit $ret
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
-- 
2.28.0


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2020-11-27  0:59 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-29  9:16 [dpdk-dev] [PATCH] build: add pkg-config validation Gregory Etelson
2020-11-01 10:01 ` Thomas Monjalon
2020-11-01 12:06   ` Gregory Etelson
2020-11-02  6:45 ` [dpdk-dev] [PATCH v2] " Gregory Etelson
2020-11-02 12:11   ` Bruce Richardson
2020-11-02 19:39     ` Gregory Etelson
2020-11-02 19:34 ` [dpdk-dev] [PATCH v3] " Gregory Etelson
2020-11-03 10:09   ` Bruce Richardson
2020-11-04  8:38     ` Gregory Etelson
2020-11-05 12:37 ` [dpdk-dev] [PATCH v4] " Gregory Etelson
2020-11-05 13:17   ` Bruce Richardson
2020-11-13 13:38   ` David Marchand
2020-11-13 15:16     ` Gregory Etelson
2020-11-13 15:32       ` David Marchand
2020-11-17 18:17 ` [dpdk-dev] [PATCH] doc: notify bug in pkg-config v0.27 Gregory Etelson
2020-11-26 15:42   ` [dpdk-dev] [PATCH v2 1/1] doc: add pkg-config requirement for applications Thomas Monjalon
2020-11-26 16:24     ` Bruce Richardson
2020-11-26 16:38       ` Thomas Monjalon
2020-11-26 16:43   ` [dpdk-dev] [PATCH v3 " Thomas Monjalon
2020-11-26 16:46     ` Bruce Richardson
2020-11-27  0:59       ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).