devtools: fix example build with old pkg-config
Checks
Commit Message
The old version of the pkg-config [1] doesn't support '-define-prefix'
and '--path' arguments which is causing failure building the
examples [2].
Added checks for pkg-config arguments support and build examples only
if they are supported.
[1]
CentOS Linux release 7.7.1908 (Core)
pkg-config version 0.27.1
[2]
## Building cmdline
Unknown option --define-prefix
gmake: Entering directory
`...ild-x86-default/install-root/usr/local/share/dpdk/examples/cmdline'
rm -f build/cmdline build/cmdline-static build/cmdline-shared
test -d build && rmdir -p build || true
Unknown option --define-prefix
Unknown option --define-prefix
gcc -O3 main.c commands.c parse_obj_list.c -o build/cmdline-shared
main.c:14:28: fatal error: cmdline_rdline.h: No such file or directory
#include <cmdline_rdline.h>
Fixes: 7f80a2102bbb ("devtools: test pkg-config file")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
Cc: Bruce Richardson <bruce.richardson@intel.com>
---
devtools/test-meson-builds.sh | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
Comments
On Fri, Nov 15, 2019 at 10:35:25AM +0000, Ferruh Yigit wrote:
> The old version of the pkg-config [1] doesn't support '-define-prefix'
> and '--path' arguments which is causing failure building the
> examples [2].
>
Yes for the define-prefix option, no for the path one.
The define-prefix argument is indeed necessary to have a properly working
pkg-config to get cflags/ldflags in this case, so we need to skip the tests
without it. However, the path parameter is only used to properly track the
dependencies of the build to enable rebuilding if the pkg-config file
itself changes. Therefore, having no output from pkg-config --path won't
cause the build to fail, so it's more an optional flag.
/Bruce
@@ -133,7 +133,10 @@ load_env cc
pc_file=$(find $DESTDIR -name libdpdk.pc)
export PKG_CONFIG_PATH=$(dirname $pc_file):$PKG_CONFIG_PATH
-for example in cmdline helloworld l2fwd l3fwd skeleton timer; do
- echo "## Building $example"
- $MAKE -C $DESTDIR/usr/local/share/dpdk/examples/$example clean all
-done
+# Ckeck pkg-config parameter support for old versions
+if pkg-config --define-prefix --path libdpdk >/dev/null 2>&1; then
+ for example in cmdline helloworld l2fwd l3fwd skeleton timer; do
+ echo "## Building $example"
+ $MAKE -C $DESTDIR/usr/local/share/dpdk/examples/$example clean all
+ done
+fi