From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex =?utf-8?Q?Benn=C3=A9e?= Subject: Re: [PATCH kvm-unit-tests] configure: fix non-newlib cross-compiling Date: Mon, 16 Jan 2017 15:22:00 +0000 Message-ID: <874m0zuj1j.fsf@linaro.org> References: <20170116132139.13839-1-drjones@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: kvm@vger.kernel.org, pbonzini@redhat.com To: Andrew Jones Return-path: Received: from mail-wm0-f41.google.com ([74.125.82.41]:38065 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750886AbdAPPWE (ORCPT ); Mon, 16 Jan 2017 10:22:04 -0500 Received: by mail-wm0-f41.google.com with SMTP id r144so179688988wme.1 for ; Mon, 16 Jan 2017 07:22:04 -0800 (PST) In-reply-to: <20170116132139.13839-1-drjones@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Andrew Jones writes: > Commit 529046c3 "libcflat: add PRI(dux)32 format types" applies a > detection trick that requires native compiling or cross-compiling > with newlib, an embedded system C standard library. We can avoid > the new dependency with a different trick. > > Cc: Alex Bennée > Signed-off-by: Andrew Jones > --- > configure | 14 +++++--------- > 1 file changed, 5 insertions(+), 9 deletions(-) > > diff --git a/configure b/configure > index 127868ce3090..3045dd129bda 100755 > --- a/configure > +++ b/configure > @@ -12,6 +12,7 @@ host=$arch > cross_prefix= > endian="" > pretty_print_stacks=yes > +u32_long= > > usage() { > cat <<-EOF > @@ -110,16 +111,11 @@ if [ -f $testdir/run ]; then > fi > > # check if uint32_t needs a long format modifier > -cat << EOF > lib_test.c > -#include > +cat << EOF > lib-test.c > +__UINT32_TYPE__ > EOF > - > -$cross_prefix$cc lib_test.c -E | grep "typedef" | grep "long" | grep "uint32_t" &> /dev/null > -exit=$? > -if [ $exit -eq 0 ]; then > - u32_long=true > -fi > -rm -f lib_test.c > +u32_long=$($cross_prefix$cc -E lib-test.c | awk '! /^#/ && $2 == "long" {print "yes"}') > +rm -f lib-test.c Hmm this fails on my system as the -E output is: 15:18 alex@overdrive01/aarch64 [kvm-unit-tests-32bit.git/review/drew-config@github] >arm-none-eabi-gcc -E test.c # 1 "test.c" # 1 "" # 1 "" # 1 "test.c" long unsigned int Changing the line to: u32_long=$($cross_prefix$cc -E lib-test.c | awk '! /^#/ && $1 == "long" {print "yes"}') Fixes the detection for me but I wonder if there are other corner cases to catch? The rest of the compile fails later due to un-merged format fixes for pci_setup_msi which I guess is expected. > > # check for dependent 32 bit libraries > if [ "$arch" != "arm" ]; then -- Alex Bennée