test-meson-builds: add a 32-bit build

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

Checks

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

Commit Message

Bruce Richardson Nov. 5, 2020, 11:07 a.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>
---
 devtools/test-meson-builds.sh | 13 +++++++++++++
 1 file changed, 13 insertions(+)
  

Comments

Thomas Monjalon Nov. 5, 2020, 11:13 a.m. UTC | #1
05/11/2020 12:07, Bruce Richardson:
> 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>

Thanks we really need such test.

> +if echo "int main(void) { return 0; }" | cc -m32 -x c - -o /dev/null 2> /dev/null ; then

I think a function would be cleaner, with -m32 passed as parameter.

> +	if [ -d "/usr/lib/i386-linux-gnu" ] ; then
> +		# 32-bit pkgconfig on debian/ubuntu
> +		export PKG_CONFIG_LIBDIR="/usr/lib/i386-linux-gnu/pkgconfig"
> +	else
> +		# 32-bit pkgconfig on RHEL/fedora (lib vs lib64)
> +		export PKG_CONFIG_LIBDIR="/usr/lib/pkgconfig"

It is /usr/lib32 on my Arch Linux.

I would prefer avoiding export,
by assigning a local variable and use it below:

PKG_CONFIG_LIBDIR=libdir32 build build-32-bit ...

> +	fi
> +	build build-32-bit cc -Dc_args='-m32' -Dc_link_args='-m32'

Or just "build-32" as directory name.

> +	unset PKG_CONFIG_LIBDIR

No need of unset if not using export above.

> +fi
  
Bruce Richardson Nov. 5, 2020, 11:21 a.m. UTC | #2
On Thu, Nov 05, 2020 at 12:13:37PM +0100, Thomas Monjalon wrote:
> 05/11/2020 12:07, Bruce Richardson:
> > 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>
> 
> Thanks we really need such test.
> 
> > +if echo "int main(void) { return 0; }" | cc -m32 -x c - -o /dev/null 2> /dev/null ; then
> 
> I think a function would be cleaner, with -m32 passed as parameter.
> 
> > +	if [ -d "/usr/lib/i386-linux-gnu" ] ; then
> > +		# 32-bit pkgconfig on debian/ubuntu
> > +		export PKG_CONFIG_LIBDIR="/usr/lib/i386-linux-gnu/pkgconfig"
> > +	else
> > +		# 32-bit pkgconfig on RHEL/fedora (lib vs lib64)
> > +		export PKG_CONFIG_LIBDIR="/usr/lib/pkgconfig"
> 
> It is /usr/lib32 on my Arch Linux.
> 
> I would prefer avoiding export,
> by assigning a local variable and use it below:
> 
> PKG_CONFIG_LIBDIR=libdir32 build build-32-bit ...
> 
> > +	fi
> > +	build build-32-bit cc -Dc_args='-m32' -Dc_link_args='-m32'
> 
> Or just "build-32" as directory name.
> 
> > +	unset PKG_CONFIG_LIBDIR
> 
> No need of unset if not using export above.
> 
> > +fi

Thanks for the quick review, I'll put together a v2 based on this feedback.

/Bruce
  
Thomas Monjalon Nov. 5, 2020, 12:56 p.m. UTC | #3
05/11/2020 12:21, Bruce Richardson:
> On Thu, Nov 05, 2020 at 12:13:37PM +0100, Thomas Monjalon wrote:
> > 05/11/2020 12:07, Bruce Richardson:
> > > 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>
> > 
> > Thanks we really need such test.
> > 
> > > +if echo "int main(void) { return 0; }" | cc -m32 -x c - -o /dev/null 2> /dev/null ; then
> > 
> > I think a function would be cleaner, with -m32 passed as parameter.
> > 
> > > +	if [ -d "/usr/lib/i386-linux-gnu" ] ; then
> > > +		# 32-bit pkgconfig on debian/ubuntu
> > > +		export PKG_CONFIG_LIBDIR="/usr/lib/i386-linux-gnu/pkgconfig"
> > > +	else
> > > +		# 32-bit pkgconfig on RHEL/fedora (lib vs lib64)
> > > +		export PKG_CONFIG_LIBDIR="/usr/lib/pkgconfig"
> > 
> > It is /usr/lib32 on my Arch Linux.
> > 
> > I would prefer avoiding export,
> > by assigning a local variable and use it below:
> > 
> > PKG_CONFIG_LIBDIR=libdir32 build build-32-bit ...
> > 
> > > +	fi
> > > +	build build-32-bit cc -Dc_args='-m32' -Dc_link_args='-m32'
> > 
> > Or just "build-32" as directory name.
> > 
> > > +	unset PKG_CONFIG_LIBDIR
> > 
> > No need of unset if not using export above.
> > 
> > > +fi
> 
> Thanks for the quick review, I'll put together a v2 based on this feedback.

One more thing, the variable DPDK_TARGET should be set
accordingly so the right configuration can be loaded.
By default, I believe it will be x86_64-pc-linux-gnu.
We need something with "32" or i686 on x86 so we can adjust
the paths to the dependencies built for 32-bit.
  
Bruce Richardson Nov. 5, 2020, 5:19 p.m. UTC | #4
On Thu, Nov 05, 2020 at 12:13:37PM +0100, Thomas Monjalon wrote:
> 05/11/2020 12:07, Bruce Richardson:
> > 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>
> 
> Thanks we really need such test.
> 
> > +if echo "int main(void) { return 0; }" | cc -m32 -x c - -o /dev/null 2> /dev/null ; then
> 
> I think a function would be cleaner, with -m32 passed as parameter.
> 
> > +	if [ -d "/usr/lib/i386-linux-gnu" ] ; then
> > +		# 32-bit pkgconfig on debian/ubuntu
> > +		export PKG_CONFIG_LIBDIR="/usr/lib/i386-linux-gnu/pkgconfig"
> > +	else
> > +		# 32-bit pkgconfig on RHEL/fedora (lib vs lib64)
> > +		export PKG_CONFIG_LIBDIR="/usr/lib/pkgconfig"
> 
> It is /usr/lib32 on my Arch Linux.
> 
> I would prefer avoiding export,
> by assigning a local variable and use it below:
> 
> PKG_CONFIG_LIBDIR=libdir32 build build-32-bit ...
> 

Not having the variable exported means that it does not seem to be passed
through to the meson (and other) subprocesses. Therefore keeping the export
as is in V2.

/Bruce
  

Patch

diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index a87de635a..02db73e98 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -226,6 +226,19 @@  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 echo "int main(void) { return 0; }" | cc -m32 -x c - -o /dev/null 2> /dev/null ; 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"
+	else
+		# 32-bit pkgconfig on RHEL/fedora (lib vs lib64)
+		export PKG_CONFIG_LIBDIR="/usr/lib/pkgconfig"
+	fi
+	build build-32-bit 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)