Errors when install QEMU from source code
Host environment
- Operating system: Ubuntu 22.04.2 LT
- OS/kernel version: Linux amd-a100-alveo 5.15.0-67-generic #74-Ubuntu SMP Wed Feb 22 14:14:39 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
- Architecture: x86
When I want to install QEMU from source code, I followed this article's recommended method of installation Emulating CXL Shared Memory Devices in QEMU.when I started to make ,errors happened.
[1117/2990] Compiling C object libqemuutil.a.p/util_userfaultfd.c.o FAILED: libqemuutil.a.p/util_userfaultfd.c.o cc -m64 -mcx16 -Ilibqemuutil.a.p -I. -I.. -Isubprojects/libvhost-user -I../subprojects/libvhost-user -Iqapi -Itrace -Iui -Iui/shader -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/gio-unix-2.0 -I/usr/include/pixman-1 -fdiagnostics-color=auto -Wall -Winvalid-pch -Werror -std=gnu11 -O2 -g -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wundef -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wimplicit-fallthrough=2 -Wmissing-format-attribute -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-psabi /mnt/nvme0/home/shs/qemu/linux-headers linux-headers -iquote . -iquote /mnt/nvme0/home/shs/qemu -iquote /mnt/nvme0/home/shs/qemu/include -iquote /mnt/nvme0/home/shs/qemu/host/include/x86_64 -iquote /mnt/nvme0/home/shs/qemu/host/include/generic -iquote /mnt/nvme0/home/shs/qemu/tcg/i386 -pthread -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fno-common -fwrapv -fPIE -MD -MQ libqemuutil.a.p/util_userfaultfd.c.o -MF libqemuutil.a.p/util_userfaultfd.c.o.d -o libqemuutil.a.p/util_userfaultfd.c.o -c ../util/userfaultfd.c ../util/userfaultfd.c: In function ‘uffd_open’: ../util/userfaultfd.c:54:32: error: ‘USERFAULTFD_IOC_NEW’ undeclared (first use in this function); did you mean ‘USERFAULTFD_H’? 54 | return ioctl(uffd_dev, USERFAULTFD_IOC_NEW, flags); | ^~~~~~~~~~~~~~~~~~~ | USERFAULTFD_H ../util/userfaultfd.c:54:32: note: each undeclared identifier is reported only once for each function it appears in the error is that USERFAULTFD_IOC_NEW can't be find,there is no USERFAULTFD_IOC_NEW in /usr/include/linux/userfaultfd.h , however ,there is a linux-headers folder ,USERFAULTFD_IOC_NEW is definded in qemu/linux-headers/linux/userfaultfd.h. Combined with the /mnt/nvme0/home/shs/qemu/linux-headers linux-headers in the compile command, it may be that the headers in this folder are intended to replace the headers in /usr/include/linux, but I don't know why it didn't work. my cpu is AMD EPYC 7773X 64-Core Processor ,linux is Ubuntu 22.04.2 LT This warning also appears when compiling other files:
[1331/2990] Compiling C object libblock.fa.p/block_blklogwrites.c.o cc: warning: /mnt/nvme0/home/shs/qemu/linux-headers: linker input file unused because linking not done cc: warning: linux-headers: linker input file unused because linking not done [1332/2990] Compiling C object tests/qtest/libqos/libqos.fa.p/pci.c.o cc: warning: /mnt/nvme0/home/shs/qemu/linux-headers: linker input file unused because linking not done cc: warning: linux-headers: linker input file unused because linking not done [1333/2990] Compiling C object libblock.fa.p/block_backup.c.o configure commond:
../configure --prefix=/opt/qemu-jic23 --target-list=i386-softmmu,x86_64-softmmu --enable-libpmem --enable-slirp the makefile is as below: