[1/1] tests/fp/meson: don't build fp-bench test if fenv.h is missing

Message ID 20240430164752.645521-1-dario.binacchi@amarulasolutions.com
State New
Headers show
Series
  • [1/1] tests/fp/meson: don't build fp-bench test if fenv.h is missing
Related show

Commit Message

Dario Binacchi April 30, 2024, 4:47 p.m. UTC
The fp-bench test (i. e. tests/fp/fp-bench.c) use fenv.h that is not
always provided by the libc (uClibc). The patch disables its compilation
in case the header is not available.

The patch is based on a suggestion from Paolo Bonzini, which you can
find at the following link.

Link: https://lists.nongnu.org/archive/html/qemu-devel/2021-03/msg00492.html
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
 tests/fp/meson.build | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

Comments

Alex Bennée April 30, 2024, 5:02 p.m. UTC | #1
Dario Binacchi <dario.binacchi@amarulasolutions.com> writes:

> The fp-bench test (i. e. tests/fp/fp-bench.c) use fenv.h that is not
> always provided by the libc (uClibc). The patch disables its compilation
> in case the header is not available.
>
> The patch is based on a suggestion from Paolo Bonzini, which you can
> find at the following link.
>
> Link: https://lists.nongnu.org/archive/html/qemu-devel/2021-03/msg00492.html
> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>

Acked-by: Alex Bennée <alex.bennee@linaro.org>
Richard Henderson April 30, 2024, 6:15 p.m. UTC | #2
On 4/30/24 09:47, Dario Binacchi wrote:
> The fp-bench test (i. e. tests/fp/fp-bench.c) use fenv.h that is not
> always provided by the libc (uClibc). The patch disables its compilation
> in case the header is not available.

Since uclibc has had fenv.h since 2008, are you sure this isn't simply a case of a corrupt 
installation?


r~

To unsubscribe from this group and stop receiving emails from it, send an email to linux-amarula+unsubscribe@amarulasolutions.com.
Dario Binacchi May 1, 2024, 12:18 p.m. UTC | #3
Hello Richard,

On Tue, Apr 30, 2024 at 8:15 PM Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> On 4/30/24 09:47, Dario Binacchi wrote:
> > The fp-bench test (i. e. tests/fp/fp-bench.c) use fenv.h that is not
> > always provided by the libc (uClibc). The patch disables its compilation
> > in case the header is not available.
>
> Since uclibc has had fenv.h since 2008, are you sure this isn't simply a case of a corrupt
> installation?

>
>
> r~

It's not an issue of corrupted installation but rather of compilation:

../tests/fp/fp-bench.c:15:10: fatal error: fenv.h: No such file or directory
   15 | #include <fenv.h>
      |          ^~~~~~~~
compilation terminated.

In Buildroot, where the error above is occurring, there already exists
a patch to
disable the compilation of the fp-bench test. This patch was created and applied
when bumping QEMU to version 6.1.0, but it is no longer applicable to
version 8.1.1.
In fixing the issue, I followed the approach suggested by Paolo
Bonzini, hoping that
this patch can be accepted and merged into QEMU.

This is the patch I just sent to Buildroot:
https://patchwork.ozlabs.org/project/buildroot/patch/20240501120050.670109-1-dario.binacchi@amarulasolutions.com/

Thanks and regards,
Dario
Richard Henderson May 1, 2024, 1:31 p.m. UTC | #4
On 5/1/24 05:18, Dario Binacchi wrote:
> Hello Richard,
> 
> On Tue, Apr 30, 2024 at 8:15 PM Richard Henderson
> <richard.henderson@linaro.org> wrote:
>>
>> On 4/30/24 09:47, Dario Binacchi wrote:
>>> The fp-bench test (i. e. tests/fp/fp-bench.c) use fenv.h that is not
>>> always provided by the libc (uClibc). The patch disables its compilation
>>> in case the header is not available.
>>
>> Since uclibc has had fenv.h since 2008, are you sure this isn't simply a case of a corrupt
>> installation?
> 
>>
>>
>> r~
> 
> It's not an issue of corrupted installation but rather of compilation:

Installation of your cross-compiler or buildroot, I mean.

> 
> ../tests/fp/fp-bench.c:15:10: fatal error: fenv.h: No such file or directory
>     15 | #include <fenv.h>
>        |          ^~~~~~~~
> compilation terminated.

Yes, yes.  However, <fenv.h> is present in uclibc-ng, and has been since 2008.
So *why* is fenv.h not present?


r~

To unsubscribe from this group and stop receiving emails from it, send an email to linux-amarula+unsubscribe@amarulasolutions.com.
Dario Binacchi May 1, 2024, 2:17 p.m. UTC | #5
Hello Richard,

On Wed, May 1, 2024 at 3:31 PM Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> On 5/1/24 05:18, Dario Binacchi wrote:
> > Hello Richard,
> >
> > On Tue, Apr 30, 2024 at 8:15 PM Richard Henderson
> > <richard.henderson@linaro.org> wrote:
> >>
> >> On 4/30/24 09:47, Dario Binacchi wrote:
> >>> The fp-bench test (i. e. tests/fp/fp-bench.c) use fenv.h that is not
> >>> always provided by the libc (uClibc). The patch disables its compilation
> >>> in case the header is not available.
> >>
> >> Since uclibc has had fenv.h since 2008, are you sure this isn't simply a case of a corrupt
> >> installation?
> >
> >>
> >>
> >> r~
> >
> > It's not an issue of corrupted installation but rather of compilation:
>
> Installation of your cross-compiler or buildroot, I mean.
>
> >
> > ../tests/fp/fp-bench.c:15:10: fatal error: fenv.h: No such file or directory
> >     15 | #include <fenv.h>
> >        |          ^~~~~~~~
> > compilation terminated.
>
> Yes, yes.  However, <fenv.h> is present in uclibc-ng, and has been since 2008.
> So *why* is fenv.h not present?

I found the fenv.h files here:
out/emulator/host/opt/ext-toolchain/i686-buildroot-linux-uclibc/include/c++/11.3.0/tr1/fenv.h
out/emulator/host/opt/ext-toolchain/i686-buildroot-linux-uclibc/include/c++/11.3.0/fenv.h

But the compiler expects them in:
out/emulator/host/i686-buildroot-linux-uclibc/sysroot/usr/include/

So, I think that the fenv support has not been enabled in uClibc
configuration of Buildroot.

Thanks and regards,
Dario

>
>
> r~
Dario Binacchi May 11, 2024, 10:11 a.m. UTC | #6
Gentle ping.

Thanks,
Dario

On Wed, May 1, 2024 at 4:17 PM Dario Binacchi
<dario.binacchi@amarulasolutions.com> wrote:
>
> Hello Richard,
>
> On Wed, May 1, 2024 at 3:31 PM Richard Henderson
> <richard.henderson@linaro.org> wrote:
> >
> > On 5/1/24 05:18, Dario Binacchi wrote:
> > > Hello Richard,
> > >
> > > On Tue, Apr 30, 2024 at 8:15 PM Richard Henderson
> > > <richard.henderson@linaro.org> wrote:
> > >>
> > >> On 4/30/24 09:47, Dario Binacchi wrote:
> > >>> The fp-bench test (i. e. tests/fp/fp-bench.c) use fenv.h that is not
> > >>> always provided by the libc (uClibc). The patch disables its compilation
> > >>> in case the header is not available.
> > >>
> > >> Since uclibc has had fenv.h since 2008, are you sure this isn't simply a case of a corrupt
> > >> installation?
> > >
> > >>
> > >>
> > >> r~
> > >
> > > It's not an issue of corrupted installation but rather of compilation:
> >
> > Installation of your cross-compiler or buildroot, I mean.
> >
> > >
> > > ../tests/fp/fp-bench.c:15:10: fatal error: fenv.h: No such file or directory
> > >     15 | #include <fenv.h>
> > >        |          ^~~~~~~~
> > > compilation terminated.
> >
> > Yes, yes.  However, <fenv.h> is present in uclibc-ng, and has been since 2008.
> > So *why* is fenv.h not present?
>
> I found the fenv.h files here:
> out/emulator/host/opt/ext-toolchain/i686-buildroot-linux-uclibc/include/c++/11.3.0/tr1/fenv.h
> out/emulator/host/opt/ext-toolchain/i686-buildroot-linux-uclibc/include/c++/11.3.0/fenv.h
>
> But the compiler expects them in:
> out/emulator/host/i686-buildroot-linux-uclibc/sysroot/usr/include/
>
> So, I think that the fenv support has not been enabled in uClibc
> configuration of Buildroot.
>
> Thanks and regards,
> Dario
>
> >
> >
> > r~
>
>
>
> --
>
> Dario Binacchi
>
> Senior Embedded Linux Developer
>
> dario.binacchi@amarulasolutions.com
>
> __________________________________
>
>
> Amarula Solutions SRL
>
> Via Le Canevare 30, 31100 Treviso, Veneto, IT
>
> T. +39 042 243 5310
> info@amarulasolutions.com
>
> www.amarulasolutions.com
Richard Henderson May 11, 2024, 10:25 a.m. UTC | #7
On 5/11/24 12:11, Dario Binacchi wrote:
> Gentle ping.

Gentle reminder that I strongly suspect that your buildroot is corrupt.
There *should* be a <fenv.h> present.


r~

> 
> Thanks,
> Dario
> 
> On Wed, May 1, 2024 at 4:17 PM Dario Binacchi
> <dario.binacchi@amarulasolutions.com> wrote:
>>
>> Hello Richard,
>>
>> On Wed, May 1, 2024 at 3:31 PM Richard Henderson
>> <richard.henderson@linaro.org> wrote:
>>>
>>> On 5/1/24 05:18, Dario Binacchi wrote:
>>>> Hello Richard,
>>>>
>>>> On Tue, Apr 30, 2024 at 8:15 PM Richard Henderson
>>>> <richard.henderson@linaro.org> wrote:
>>>>>
>>>>> On 4/30/24 09:47, Dario Binacchi wrote:
>>>>>> The fp-bench test (i. e. tests/fp/fp-bench.c) use fenv.h that is not
>>>>>> always provided by the libc (uClibc). The patch disables its compilation
>>>>>> in case the header is not available.
>>>>>
>>>>> Since uclibc has had fenv.h since 2008, are you sure this isn't simply a case of a corrupt
>>>>> installation?
>>>>
>>>>>
>>>>>
>>>>> r~
>>>>
>>>> It's not an issue of corrupted installation but rather of compilation:
>>>
>>> Installation of your cross-compiler or buildroot, I mean.
>>>
>>>>
>>>> ../tests/fp/fp-bench.c:15:10: fatal error: fenv.h: No such file or directory
>>>>      15 | #include <fenv.h>
>>>>         |          ^~~~~~~~
>>>> compilation terminated.
>>>
>>> Yes, yes.  However, <fenv.h> is present in uclibc-ng, and has been since 2008.
>>> So *why* is fenv.h not present?
>>
>> I found the fenv.h files here:
>> out/emulator/host/opt/ext-toolchain/i686-buildroot-linux-uclibc/include/c++/11.3.0/tr1/fenv.h
>> out/emulator/host/opt/ext-toolchain/i686-buildroot-linux-uclibc/include/c++/11.3.0/fenv.h
>>
>> But the compiler expects them in:
>> out/emulator/host/i686-buildroot-linux-uclibc/sysroot/usr/include/
>>
>> So, I think that the fenv support has not been enabled in uClibc
>> configuration of Buildroot.
>>
>> Thanks and regards,
>> Dario
>>
>>>
>>>
>>> r~
>>
>>
>>
>> --
>>
>> Dario Binacchi
>>
>> Senior Embedded Linux Developer
>>
>> dario.binacchi@amarulasolutions.com
>>
>> __________________________________
>>
>>
>> Amarula Solutions SRL
>>
>> Via Le Canevare 30, 31100 Treviso, Veneto, IT
>>
>> T. +39 042 243 5310
>> info@amarulasolutions.com
>>
>> www.amarulasolutions.com
> 
> 
> 

To unsubscribe from this group and stop receiving emails from it, send an email to linux-amarula+unsubscribe@amarulasolutions.com.
Dario Binacchi May 11, 2024, 11:09 a.m. UTC | #8
On Sat, May 11, 2024 at 12:25 PM Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> On 5/11/24 12:11, Dario Binacchi wrote:
> > Gentle ping.
>
> Gentle reminder that I strongly suspect that your buildroot is corrupt.
> There *should* be a <fenv.h> present.

I don't think so. In fact, the patch has already been merged into Buildroot:
https://patchwork.ozlabs.org/project/buildroot/patch/20240502072327.741463-1-dario.binacchi@amarulasolutions.com/

As mentioned earlier:
"The fenv support is not enabled in our default uClibc configurations"
https://lists.buildroot.org/pipermail/buildroot/2013-May/072440.html

Thanks and regards,
Dario


>
>
> r~
>
> >
> > Thanks,
> > Dario
> >
> > On Wed, May 1, 2024 at 4:17 PM Dario Binacchi
> > <dario.binacchi@amarulasolutions.com> wrote:
> >>
> >> Hello Richard,
> >>
> >> On Wed, May 1, 2024 at 3:31 PM Richard Henderson
> >> <richard.henderson@linaro.org> wrote:
> >>>
> >>> On 5/1/24 05:18, Dario Binacchi wrote:
> >>>> Hello Richard,
> >>>>
> >>>> On Tue, Apr 30, 2024 at 8:15 PM Richard Henderson
> >>>> <richard.henderson@linaro.org> wrote:
> >>>>>
> >>>>> On 4/30/24 09:47, Dario Binacchi wrote:
> >>>>>> The fp-bench test (i. e. tests/fp/fp-bench.c) use fenv.h that is not
> >>>>>> always provided by the libc (uClibc). The patch disables its compilation
> >>>>>> in case the header is not available.
> >>>>>
> >>>>> Since uclibc has had fenv.h since 2008, are you sure this isn't simply a case of a corrupt
> >>>>> installation?
> >>>>
> >>>>>
> >>>>>
> >>>>> r~
> >>>>
> >>>> It's not an issue of corrupted installation but rather of compilation:
> >>>
> >>> Installation of your cross-compiler or buildroot, I mean.
> >>>
> >>>>
> >>>> ../tests/fp/fp-bench.c:15:10: fatal error: fenv.h: No such file or directory
> >>>>      15 | #include <fenv.h>
> >>>>         |          ^~~~~~~~
> >>>> compilation terminated.
> >>>
> >>> Yes, yes.  However, <fenv.h> is present in uclibc-ng, and has been since 2008.
> >>> So *why* is fenv.h not present?
> >>
> >> I found the fenv.h files here:
> >> out/emulator/host/opt/ext-toolchain/i686-buildroot-linux-uclibc/include/c++/11.3.0/tr1/fenv.h
> >> out/emulator/host/opt/ext-toolchain/i686-buildroot-linux-uclibc/include/c++/11.3.0/fenv.h
> >>
> >> But the compiler expects them in:
> >> out/emulator/host/i686-buildroot-linux-uclibc/sysroot/usr/include/
> >>
> >> So, I think that the fenv support has not been enabled in uClibc
> >> configuration of Buildroot.
> >>
> >> Thanks and regards,
> >> Dario
> >>
> >>>
> >>>
> >>> r~
> >>
> >>
> >>
> >> --
> >>
> >> Dario Binacchi
> >>
> >> Senior Embedded Linux Developer
> >>
> >> dario.binacchi@amarulasolutions.com
> >>
> >> __________________________________
> >>
> >>
> >> Amarula Solutions SRL
> >>
> >> Via Le Canevare 30, 31100 Treviso, Veneto, IT
> >>
> >> T. +39 042 243 5310
> >> info@amarulasolutions.com
> >>
> >> www.amarulasolutions.com
> >
> >
> >
>
Thomas Huth May 13, 2024, 10:10 a.m. UTC | #9
On 11/05/2024 13.09, Dario Binacchi wrote:
> On Sat, May 11, 2024 at 12:25 PM Richard Henderson
> <richard.henderson@linaro.org> wrote:
>>
>> On 5/11/24 12:11, Dario Binacchi wrote:
>>> Gentle ping.
>>
>> Gentle reminder that I strongly suspect that your buildroot is corrupt.
>> There *should* be a <fenv.h> present.
> 
> I don't think so. In fact, the patch has already been merged into Buildroot:
> https://patchwork.ozlabs.org/project/buildroot/patch/20240502072327.741463-1-dario.binacchi@amarulasolutions.com/
> 
> As mentioned earlier:
> "The fenv support is not enabled in our default uClibc configurations"
> https://lists.buildroot.org/pipermail/buildroot/2013-May/072440.html

So the missing information from that page is: It's apparently possible to 
build uClibc without fenv support, it's only optional there!

So IMHO this patch is fine and should be included.

  Thomas

To unsubscribe from this group and stop receiving emails from it, send an email to linux-amarula+unsubscribe@amarulasolutions.com.
Alex Bennée May 13, 2024, 12:21 p.m. UTC | #10
Dario Binacchi <dario.binacchi@amarulasolutions.com> writes:

> On Sat, May 11, 2024 at 12:25 PM Richard Henderson
> <richard.henderson@linaro.org> wrote:
>>
>> On 5/11/24 12:11, Dario Binacchi wrote:
>> > Gentle ping.
>>
>> Gentle reminder that I strongly suspect that your buildroot is corrupt.
>> There *should* be a <fenv.h> present.
>
> I don't think so. In fact, the patch has already been merged into Buildroot:
> https://patchwork.ozlabs.org/project/buildroot/patch/20240502072327.741463-1-dario.binacchi@amarulasolutions.com/
>
> As mentioned earlier:
> "The fenv support is not enabled in our default uClibc configurations"
> https://lists.buildroot.org/pipermail/buildroot/2013-May/072440.html

Given this is outside of the general QEMU support matrix (we have Musl
but we make no comment about uClibc) and doesn't address the other users
of fenv.h (check-tcg binaries built with host compiler) I think this
patch probably should just live on in the downstream.

Patch

diff --git a/tests/fp/meson.build b/tests/fp/meson.build
index 114b4b483ea7..0e1237be54ed 100644
--- a/tests/fp/meson.build
+++ b/tests/fp/meson.build
@@ -126,12 +126,14 @@  test('fp-test-mulAdd', fptest,
            ['f16_mulAdd', 'f32_mulAdd', 'f64_mulAdd', 'f128_mulAdd'],
      suite: ['softfloat-slow', 'softfloat-ops-slow', 'slow'], timeout: 180)
 
-executable(
-  'fp-bench',
-  ['fp-bench.c', '../../fpu/softfloat.c'],
-  dependencies: [qemuutil, libtestfloat, libsoftfloat],
-  c_args: fpcflags,
-)
+if cc.has_header('fenv.h')
+  executable(
+    'fp-bench',
+    ['fp-bench.c', '../../fpu/softfloat.c'],
+    dependencies: [qemuutil, libtestfloat, libsoftfloat],
+    c_args: fpcflags,
+  )
+endif
 
 fptestlog2 = executable(
   'fp-test-log2',