qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: "Milan P. Stanić" <mps@arvanta.net>, qemu-devel@nongnu.org
Subject: Re: [PATCH v2 1/1] util/util/cpuinfo-riscv.c: fix riscv64 build on musl libc
Date: Thu, 5 Sep 2024 20:57:46 +0100	[thread overview]
Message-ID: <CAFEAcA8yaVZHToNyU3D7nPX37RAqLWW9zxPD6TuSHk5PVaCM3g@mail.gmail.com> (raw)
In-Reply-To: <aca89438-a7c0-4cd9-9668-2917a04ec779@linaro.org>

On Thu, 5 Sept 2024 at 20:44, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> On 9/5/24 08:06, Milan P. Stanić 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..8cacc67645 100644
> > --- a/util/cpuinfo-riscv.c
> > +++ b/util/cpuinfo-riscv.c
> > @@ -9,6 +9,7 @@
> >   #ifdef CONFIG_ASM_HWPROBE_H
> >   #include <asm/hwprobe.h>
> >   #include <sys/syscall.h>
> > +#include <asm/unistd.h>
>
> I suppose this is ok, but...
>
> For some reason musl processes asm/unistd.h at build-time to produce <bits/syscall.h>,
> which is included by <sys/syscall.h>.  This will be "fixed" the next time musl is rebuilt
> against current kernel headers.

It matches how we include asm/unistd.h in memfd.c so
we can get __NR_memfd_create, so it seems OK to me.
We ought to be able to build against older musl too, not
just those which are up-to-date with their kernel headers.

-- PMM


  reply	other threads:[~2024-09-05 19:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-05 15:06 [PATCH v2 1/1] util/util/cpuinfo-riscv.c: fix riscv64 build on musl libc Milan P. Stanić
2024-09-05 19:44 ` Richard Henderson
2024-09-05 19:57   ` Peter Maydell [this message]
2024-09-06  0:53 ` Alistair Francis
2024-09-06  1:28 ` Alistair Francis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFEAcA8yaVZHToNyU3D7nPX37RAqLWW9zxPD6TuSHk5PVaCM3g@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=mps@arvanta.net \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).