public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH kvm-unit-tests v2] configure: fix non-newlib cross-compiling
@ 2017-01-16 16:07 Andrew Jones
  2017-01-17 11:54 ` Alex Bennée
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Jones @ 2017-01-16 16:07 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini, Alex Bennée

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 <alex.bennee@linaro.org>
Signed-off-by: Andrew Jones <drjones@redhat.com>

---
v2: drop the awk magic and just grep for long, as not all compilers
    have long in the same place
---
 configure | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/configure b/configure
index 127868ce3090..a05a4e3a5bc3 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 <inttypes.h>
+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=$(gcc -E lib-test.c | grep -v '^#' | grep -q long && echo yes)
+rm -f lib-test.c
 
 # check for dependent 32 bit libraries
 if [ "$arch" != "arm" ]; then
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH kvm-unit-tests v2] configure: fix non-newlib cross-compiling
  2017-01-16 16:07 [PATCH kvm-unit-tests v2] configure: fix non-newlib cross-compiling Andrew Jones
@ 2017-01-17 11:54 ` Alex Bennée
  2017-01-17 12:36   ` Andrew Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Bennée @ 2017-01-17 11:54 UTC (permalink / raw)
  To: Andrew Jones; +Cc: kvm, pbonzini


Andrew Jones <drjones@redhat.com> 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 <alex.bennee@linaro.org>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
>
> ---
> v2: drop the awk magic and just grep for long, as not all compilers
>     have long in the same place
> ---
>  configure | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/configure b/configure
> index 127868ce3090..a05a4e3a5bc3 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 <inttypes.h>
> +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=$(gcc -E lib-test.c | grep -v '^#' | grep -q long && echo yes)

Erm you'll need to use the cross compiler here...

  u32_long=$($cross_prefix$cc -E lib-test.c | grep -v '^#' | grep -q long && echo yes)

--
Alex Bennée

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH kvm-unit-tests v2] configure: fix non-newlib cross-compiling
  2017-01-17 11:54 ` Alex Bennée
@ 2017-01-17 12:36   ` Andrew Jones
  2017-01-17 15:21     ` Alex Bennée
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Jones @ 2017-01-17 12:36 UTC (permalink / raw)
  To: Alex Bennée; +Cc: kvm, pbonzini

On Tue, Jan 17, 2017 at 11:54:17AM +0000, Alex Bennée wrote:
> 
> Andrew Jones <drjones@redhat.com> 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 <alex.bennee@linaro.org>
> > Signed-off-by: Andrew Jones <drjones@redhat.com>
> >
> > ---
> > v2: drop the awk magic and just grep for long, as not all compilers
> >     have long in the same place
> > ---
> >  configure | 14 +++++---------
> >  1 file changed, 5 insertions(+), 9 deletions(-)
> >
> > diff --git a/configure b/configure
> > index 127868ce3090..a05a4e3a5bc3 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 <inttypes.h>
> > +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=$(gcc -E lib-test.c | grep -v '^#' | grep -q long && echo yes)
> 
> Erm you'll need to use the cross compiler here...

Argh. I copy+pasted that from my 3-line test script without remembering
to change it. v3 coming...

Thanks,
drew

> 
>   u32_long=$($cross_prefix$cc -E lib-test.c | grep -v '^#' | grep -q long && echo yes)
> 
> --
> Alex Bennée
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH kvm-unit-tests v2] configure: fix non-newlib cross-compiling
  2017-01-17 12:36   ` Andrew Jones
@ 2017-01-17 15:21     ` Alex Bennée
  2017-01-17 15:55       ` Andrew Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Bennée @ 2017-01-17 15:21 UTC (permalink / raw)
  To: Andrew Jones; +Cc: kvm, pbonzini


Andrew Jones <drjones@redhat.com> writes:

> On Tue, Jan 17, 2017 at 11:54:17AM +0000, Alex Bennée wrote:
>>
>> Andrew Jones <drjones@redhat.com> 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 <alex.bennee@linaro.org>
>> > Signed-off-by: Andrew Jones <drjones@redhat.com>
>> >
>> > ---
>> > v2: drop the awk magic and just grep for long, as not all compilers
>> >     have long in the same place
>> > ---
>> >  configure | 14 +++++---------
>> >  1 file changed, 5 insertions(+), 9 deletions(-)
>> >
>> > diff --git a/configure b/configure
>> > index 127868ce3090..a05a4e3a5bc3 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 <inttypes.h>
>> > +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=$(gcc -E lib-test.c | grep -v '^#' | grep -q long && echo yes)
>>
>> Erm you'll need to use the cross compiler here...
>
> Argh. I copy+pasted that from my 3-line test script without remembering
> to change it. v3 coming...

I can include your fixed patch in the series I'm about to post if you
want?

--
Alex Bennée

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH kvm-unit-tests v2] configure: fix non-newlib cross-compiling
  2017-01-17 15:21     ` Alex Bennée
@ 2017-01-17 15:55       ` Andrew Jones
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Jones @ 2017-01-17 15:55 UTC (permalink / raw)
  To: Alex Bennée; +Cc: kvm, pbonzini

On Tue, Jan 17, 2017 at 03:21:15PM +0000, Alex Bennée wrote:
> 
> Andrew Jones <drjones@redhat.com> writes:
> 
> > On Tue, Jan 17, 2017 at 11:54:17AM +0000, Alex Bennée wrote:
> >>
> >> Andrew Jones <drjones@redhat.com> 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 <alex.bennee@linaro.org>
> >> > Signed-off-by: Andrew Jones <drjones@redhat.com>
> >> >
> >> > ---
> >> > v2: drop the awk magic and just grep for long, as not all compilers
> >> >     have long in the same place
> >> > ---
> >> >  configure | 14 +++++---------
> >> >  1 file changed, 5 insertions(+), 9 deletions(-)
> >> >
> >> > diff --git a/configure b/configure
> >> > index 127868ce3090..a05a4e3a5bc3 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 <inttypes.h>
> >> > +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=$(gcc -E lib-test.c | grep -v '^#' | grep -q long && echo yes)
> >>
> >> Erm you'll need to use the cross compiler here...
> >
> > Argh. I copy+pasted that from my 3-line test script without remembering
> > to change it. v3 coming...
> 
> I can include your fixed patch in the series I'm about to post if you
> want?

I already posted it and Radim says he'll pick it up now if you say it's
good to go.

Thanks,
drew

> 
> --
> Alex Bennée

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-01-17 16:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-16 16:07 [PATCH kvm-unit-tests v2] configure: fix non-newlib cross-compiling Andrew Jones
2017-01-17 11:54 ` Alex Bennée
2017-01-17 12:36   ` Andrew Jones
2017-01-17 15:21     ` Alex Bennée
2017-01-17 15:55       ` Andrew Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox