diff mbox series

[v2] test-meson-builds: add a 32-bit build

Message ID 20201105172144.516685-1-bruce.richardson@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series [v2] test-meson-builds: add a 32-bit build | expand

Checks

Context Check Description
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional fail Functional Testing issues
ci/travis-robot success Travis build: passed
ci/iol-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/checkpatch warning coding style issues

Commit Message

Bruce Richardson Nov. 5, 2020, 5:21 p.m. UTC
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(+)

Comments

Thomas Monjalon Nov. 6, 2020, 12:40 p.m. UTC | #1
05/11/2020 18:21, Bruce Richardson:
> +	DPDK_TARGET_OVERRIDE="i386-pc-linux-gnu" \
> +		build build-32b cc -Dc_args='-m32' -Dc_link_args='-m32'

Surprinsingly, DPDK_TARGET_OVERRIDE is set in the global context,
so it seems unset is required.

I will send a v3 with other details changed.
Bruce Richardson Nov. 6, 2020, 2:08 p.m. UTC | #2
On Fri, Nov 06, 2020 at 01:40:54PM +0100, Thomas Monjalon wrote:
> 05/11/2020 18:21, Bruce Richardson:
> > +	DPDK_TARGET_OVERRIDE="i386-pc-linux-gnu" \
> > +		build build-32b cc -Dc_args='-m32' -Dc_link_args='-m32'
> 
> Surprinsingly, DPDK_TARGET_OVERRIDE is set in the global context,
> so it seems unset is required.
> 
> I will send a v3 with other details changed. 
> 
Ok, thanks.
diff mbox series

Patch

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)