* [PATCH] util/util/cpuinfo-riscv.c: fix riscv64 build on musl libc
@ 2024-09-05 11:24 Milan P. Stanić
2024-09-05 13:45 ` Peter Maydell
0 siblings, 1 reply; 3+ messages in thread
From: Milan P. Stanić @ 2024-09-05 11:24 UTC (permalink / raw)
To: qemu-devel; +Cc: Milan P . Stanić
build fails on musl libc (alpine linux) with this error:
../util/cpuinfo-riscv.c: In function 'cpuinfo_init':
../util/cpuinfo-riscv.c:63:21: error: '__NR_riscv_hwprobe' undeclared (first use in this function); did you mean 'riscv_hwprobe'?
63 | if (syscall(__NR_riscv_hwprobe, &pair, 1, 0, NULL, 0) == 0
| ^~~~~~~~~~~~~~~~~~
| riscv_hwprobe
../util/cpuinfo-riscv.c:63:21: note: each undeclared identifier is reported only once for each function it appears in
ninja: subcommand failed
add '#include "asm/unistd.h"' to util/cpuinfo-riscv.c fixes build
Signed-off-by: Milan P. Stanić <mps@arvanta.net>
---
util/cpuinfo-riscv.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/util/cpuinfo-riscv.c b/util/cpuinfo-riscv.c
index 497ce12680..f4779ed1fb 100644
--- a/util/cpuinfo-riscv.c
+++ b/util/cpuinfo-riscv.c
@@ -5,6 +5,7 @@
#include "qemu/osdep.h"
#include "host/cpuinfo.h"
+#include "asm/unistd.h"
#ifdef CONFIG_ASM_HWPROBE_H
#include <asm/hwprobe.h>
--
2.46.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] util/util/cpuinfo-riscv.c: fix riscv64 build on musl libc
2024-09-05 11:24 [PATCH] util/util/cpuinfo-riscv.c: fix riscv64 build on musl libc Milan P. Stanić
@ 2024-09-05 13:45 ` Peter Maydell
2024-09-05 14:32 ` Milan P. Stanić
0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2024-09-05 13:45 UTC (permalink / raw)
To: Milan P. Stanić; +Cc: qemu-devel
On Thu, 5 Sept 2024 at 14:19, Milan P. Stanić <mps@arvanta.net> wrote:
>
> build fails on musl libc (alpine linux) with this error:
>
> ../util/cpuinfo-riscv.c: In function 'cpuinfo_init':
> ../util/cpuinfo-riscv.c:63:21: error: '__NR_riscv_hwprobe' undeclared (first use in this function); did you mean 'riscv_hwprobe'?
> 63 | if (syscall(__NR_riscv_hwprobe, &pair, 1, 0, NULL, 0) == 0
> | ^~~~~~~~~~~~~~~~~~
> | riscv_hwprobe
> ../util/cpuinfo-riscv.c:63:21: note: each undeclared identifier is reported only once for each function it appears in
> ninja: subcommand failed
>
> add '#include "asm/unistd.h"' to util/cpuinfo-riscv.c fixes build
>
> Signed-off-by: Milan P. Stanić <mps@arvanta.net>
> ---
> util/cpuinfo-riscv.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/util/cpuinfo-riscv.c b/util/cpuinfo-riscv.c
> index 497ce12680..f4779ed1fb 100644
> --- a/util/cpuinfo-riscv.c
> +++ b/util/cpuinfo-riscv.c
> @@ -5,6 +5,7 @@
>
> #include "qemu/osdep.h"
> #include "host/cpuinfo.h"
> +#include "asm/unistd.h"
>
> #ifdef CONFIG_ASM_HWPROBE_H
> #include <asm/hwprobe.h>
> --
Hi; thanks for this patch. I think the new include line should
go inside the #ifdef CONFIG_ASM_HWPROBE_H block you can
see in the patch here, because the __NR_riscv_hwprobe symbol
we want from it is only used by code that's guarded by that ifdef.
(Otherwise we'll probably fail to compile on non-Linux hosts.)
System header includes should also use <...>, not "...".
thanks
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] util/util/cpuinfo-riscv.c: fix riscv64 build on musl libc
2024-09-05 13:45 ` Peter Maydell
@ 2024-09-05 14:32 ` Milan P. Stanić
0 siblings, 0 replies; 3+ messages in thread
From: Milan P. Stanić @ 2024-09-05 14:32 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-devel
Hi,
On Thu, 2024-09-05 at 14:45, Peter Maydell wrote:
> On Thu, 5 Sept 2024 at 14:19, Milan P. Stanić <mps@arvanta.net> wrote:
> >
> > build fails on musl libc (alpine linux) with this error:
> >
> > ../util/cpuinfo-riscv.c: In function 'cpuinfo_init':
> > ../util/cpuinfo-riscv.c:63:21: error: '__NR_riscv_hwprobe' undeclared (first use in this function); did you mean 'riscv_hwprobe'?
> > 63 | if (syscall(__NR_riscv_hwprobe, &pair, 1, 0, NULL, 0) == 0
> > | ^~~~~~~~~~~~~~~~~~
> > | riscv_hwprobe
> > ../util/cpuinfo-riscv.c:63:21: note: each undeclared identifier is reported only once for each function it appears in
> > ninja: subcommand failed
> >
> > add '#include "asm/unistd.h"' to util/cpuinfo-riscv.c fixes build
> >
> > Signed-off-by: Milan P. Stanić <mps@arvanta.net>
> > ---
> > util/cpuinfo-riscv.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/util/cpuinfo-riscv.c b/util/cpuinfo-riscv.c
> > index 497ce12680..f4779ed1fb 100644
> > --- a/util/cpuinfo-riscv.c
> > +++ b/util/cpuinfo-riscv.c
> > @@ -5,6 +5,7 @@
> >
> > #include "qemu/osdep.h"
> > #include "host/cpuinfo.h"
> > +#include "asm/unistd.h"
> >
> > #ifdef CONFIG_ASM_HWPROBE_H
> > #include <asm/hwprobe.h>
> > --
>
> Hi; thanks for this patch. I think the new include line should
> go inside the #ifdef CONFIG_ASM_HWPROBE_H block you can
> see in the patch here, because the __NR_riscv_hwprobe symbol
> we want from it is only used by code that's guarded by that ifdef.
> (Otherwise we'll probably fail to compile on non-Linux hosts.)
>
> System header includes should also use <...>, not "...".
Right. Will send patch v2 soon.
Thanks for help
--
Kind regards
> thanks
> -- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-09-05 14:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-05 11:24 [PATCH] util/util/cpuinfo-riscv.c: fix riscv64 build on musl libc Milan P. Stanić
2024-09-05 13:45 ` Peter Maydell
2024-09-05 14:32 ` Milan P. Stanić
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).