RISC-V KVM build error with Alpine Linux
Host environment
-
Operating system: Alpine linux edge
-
OS/kernel version: Linux ncopa-edge-riscv64 6.1.40-0-lts #1-Alpine SMP PREEMPT_DYNAMIC Mon, 24 Jul 2023 08:57:36 +0000 riscv64 Linux
-
Architecture: riscv64
-
QEMU flavor: n/a
-
QEMU version: 8.1.3
-
QEMU command line: n/a
Emulated/Virtualized environment
- Operating system: n/a
- OS/kernel version: n/a
- Architecture: n/a
Description of problem
Native build of qemu fails on alpine linux riscv64.
Steps to reproduce
- install alpine on riscv or set up a container with qemu-riscv64
- build qemu 8.1.3 from source
Additional information
kvm.c:(.text+0xc50): undefined reference to `strerrorname_np'
/usr/lib/gcc/riscv64-alpine-linux-musl/13.2.1/../../../../riscv64-alpine-linux-musl/bin/ld: libqemu-riscv64-softmmu.fa.p/target_riscv_kvm.c.o: in function `.L0 ':
kvm.c:(.text+0xcda): undefined reference to `strerrorname_np'
/usr/lib/gcc/riscv64-alpine-linux-musl/13.2.1/../../../../riscv64-alpine-linux-musl/bin/ld: libqemu-riscv64-softmmu.fa.p/target_riscv_kvm.c.o: in function `.L111':
kvm.c:(.text+0xd02): undefined reference to `strerrorname_np'
The strerrorname_np
is a GNU specific non-portable function (that what _np stands for). This is the only place where it is use in the entire qemu codebase:
$ rg strerrorname_np
target/riscv/kvm/kvm-cpu.c
837: strerrorname_np(errno));
899: strerrorname_np(errno));
909: strerrorname_np(errno));
932: strerrorname_np(errno));
Seems like other places uses strerror(errno)
.