DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, david.marchand@redhat.com,
	Bruce Richardson <bruce.richardson@intel.com>
Subject: [dpdk-dev] [PATCH v2] test-meson-builds: add a 32-bit build
Date: Thu,  5 Nov 2020 17:21:45 +0000	[thread overview]
Message-ID: <20201105172144.516685-1-bruce.richardson@intel.com> (raw)
In-Reply-To: <20201105110728.220957-1-bruce.richardson@intel.com>

It's reasonably common for patches to have issues when built on 32-bits, so
to prevent this, we can add a 32-bit build (if supported) to the
"test-meson-builds.sh" script. The tricky bit is using a valid
PKG_CONFIG_LIBDIR, so for now we use two common possibilities for where that
should point to in order to get a successful build.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
V2: added separate flag checking function
    added override of the DPDK_TARGET value
    added /usr/lib32 as possible 32-bit libdir
---
 devtools/test-meson-builds.sh | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index a87de635a2..47786dcd69 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -43,6 +43,11 @@ default_cppflags=$CPPFLAGS
 default_cflags=$CFLAGS
 default_ldflags=$LDFLAGS
 
+check_cc_flags () # <flag to check> <flag2> ...
+{
+	echo "int main(void) { return 0; }" | cc $@ -x c - -o /dev/null 2> /dev/null
+}
+
 load_env () # <target compiler>
 {
 	targetcc=$1
@@ -57,6 +62,10 @@ load_env () # <target compiler>
 	else # toolchain not yet in PATH: its name should be enough
 		DPDK_TARGET=$targetcc
 	fi
+	if [ -n "$DPDK_TARGET_OVERRIDE" ] ; then
+		DPDK_TARGET=$DPDK_TARGET_OVERRIDE
+	fi
+	echo "Using DPDK_TARGET $DPDK_TARGET"
 	# config input: $DPDK_TARGET
 	. $srcdir/devtools/load-devel-config
 	# config output: $DPDK_MESON_OPTIONS, $PATH, $PKG_CONFIG_PATH, etc
@@ -226,6 +235,23 @@ for f in $srcdir/config/ppc/ppc* ; do
 	build build-$(basename $f | cut -d'-' -f-2) $f $use_shared
 done
 
+# test a 32-bit build
+if check_cc_flags '-m32' ; then
+	if [ -d "/usr/lib/i386-linux-gnu" ] ; then
+		# 32-bit pkgconfig on debian/ubuntu
+		export PKG_CONFIG_LIBDIR="/usr/lib/i386-linux-gnu/pkgconfig"
+	elif [ -d "/usr/lib32" ] ; then
+		# 32-bit pkgconfig on arch
+		export PKG_CONFIG_LIBDIR="/usr/lib32/pkgconfig"
+	else
+		# 32-bit pkgconfig on RHEL/fedora (lib vs lib64)
+		export PKG_CONFIG_LIBDIR="/usr/lib/pkgconfig"
+	fi
+	DPDK_TARGET_OVERRIDE="i386-pc-linux-gnu" \
+		build build-32b cc -Dc_args='-m32' -Dc_link_args='-m32'
+	unset PKG_CONFIG_LIBDIR
+fi
+
 # Test installation of the x86-default target, to be used for checking
 # the sample apps build using the pkg-config file for cflags and libs
 build_path=$(readlink -f $builds_dir/build-x86-default)
-- 
2.25.1


  parent reply	other threads:[~2020-11-05 17:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-05 11:07 [dpdk-dev] [PATCH] " Bruce Richardson
2020-11-05 11:13 ` Thomas Monjalon
2020-11-05 11:21   ` Bruce Richardson
2020-11-05 12:56     ` Thomas Monjalon
2020-11-05 17:19   ` Bruce Richardson
2020-11-05 17:21 ` Bruce Richardson [this message]
2020-11-06 12:40   ` [dpdk-dev] [PATCH v2] " Thomas Monjalon
2020-11-06 14:08     ` Bruce Richardson
2020-11-06 16:56 ` [dpdk-dev] [PATCH v3 1/1] devtools: test " Thomas Monjalon
2020-11-06 17:01   ` Bruce Richardson
2020-11-06 17:11     ` Thomas Monjalon
2020-11-06 17:30       ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201105172144.516685-1-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).