summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-08-03 19:21:19 +0100
committerSam James <sam@gentoo.org>2022-08-03 19:21:25 +0100
commitdb2a2bbc7edbb87b7c179b8cc61bef689a5211c5 (patch)
tree3d96d7544d64bc036f4502f66274fbfbcd1db564
parentapp-emulation/libvirt: fix build w/ glibc 2.36 (diff)
downloadgentoo-db2a2bbc7edbb87b7c179b8cc61bef689a5211c5.tar.gz
gentoo-db2a2bbc7edbb87b7c179b8cc61bef689a5211c5.tar.bz2
gentoo-db2a2bbc7edbb87b7c179b8cc61bef689a5211c5.zip
app-emulation/qemu: fix build w/ glibc 2.36
Closes: https://bugs.gentoo.org/863443 Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--app-emulation/qemu/files/qemu-7.0.0-glibc-2.36.patch90
-rw-r--r--app-emulation/qemu/qemu-7.0.0-r3.ebuild1
2 files changed, 91 insertions, 0 deletions
diff --git a/app-emulation/qemu/files/qemu-7.0.0-glibc-2.36.patch b/app-emulation/qemu/files/qemu-7.0.0-glibc-2.36.patch
new file mode 100644
index 000000000000..85343c4d00e7
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-7.0.0-glibc-2.36.patch
@@ -0,0 +1,90 @@
+https://lore.kernel.org/all/20220802183409.GB2040@redhat.com/T/
+https://bugs.gentoo.org/863443
+
+From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
+To: qemu-devel@nongnu.org
+Cc: Laurent Vivier <laurent@vivier.eu>,
+ =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
+Subject: [PATCH for 7.1] linux-user: fix compat with glibc >= 2.36 sys/mount.h
+Date: Tue, 2 Aug 2022 12:41:34 -0400
+
+The latest glibc 2.36 has extended sys/mount.h so that it
+defines the FSCONFIG_* enum constants. These are historically
+defined in linux/mount.h, and thus if you include both headers
+the compiler complains:
+
+In file included from /usr/include/linux/fs.h:19,
+ from ../linux-user/syscall.c:98:
+/usr/include/linux/mount.h:95:6: error: redeclaration of 'enum fsconfig_command'
+ 95 | enum fsconfig_command {
+ | ^~~~~~~~~~~~~~~~
+In file included from ../linux-user/syscall.c:31:
+/usr/include/sys/mount.h:189:6: note: originally defined here
+ 189 | enum fsconfig_command
+ | ^~~~~~~~~~~~~~~~
+/usr/include/linux/mount.h:96:9: error: redeclaration of enumerator 'FSCONFIG_SET_FLAG'
+ 96 | FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */
+ | ^~~~~~~~~~~~~~~~~
+/usr/include/sys/mount.h:191:3: note: previous definition of 'FSCONFIG_SET_FLAG' with type 'enum fsconfig_command'
+ 191 | FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */
+ | ^~~~~~~~~~~~~~~~~
+...snip...
+
+QEMU doesn't include linux/mount.h, but it does use
+linux/fs.h and thus gets linux/mount.h indirectly.
+
+glibc acknowledges this problem but does not appear to
+be intending to fix it in the forseeable future, simply
+documenting it as a known incompatibility with no
+workaround:
+
+ https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3E_and_.3Csys.2Fmount.h.3E
+ https://sourceware.org/glibc/wiki/Synchronizing_Headers
+
+To address this requires either removing use of sys/mount.h
+or linux/fs.h, despite QEMU needing declarations from
+both.
+
+This patch removes linux/fs.h, meaning we have to define
+various FS_IOC constants that are now unavailable.
+
+Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
+--- a/linux-user/syscall.c
++++ b/linux-user/syscall.c
+@@ -95,7 +95,25 @@
+ #include <linux/soundcard.h>
+ #include <linux/kd.h>
+ #include <linux/mtio.h>
++
++#ifdef HAVE_SYS_MOUNT_FSCONFIG
++/*
++ * glibc >= 2.36 linux/mount.h conflicts with sys/mount.h,
++ * which in turn prevents use of linux/fs.h. So we have to
++ * define the constants ourselves for now.
++ */
++#define FS_IOC_GETFLAGS _IOR('f', 1, long)
++#define FS_IOC_SETFLAGS _IOW('f', 2, long)
++#define FS_IOC_GETVERSION _IOR('v', 1, long)
++#define FS_IOC_SETVERSION _IOW('v', 2, long)
++#define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap)
++#define FS_IOC32_GETFLAGS _IOR('f', 1, int)
++#define FS_IOC32_SETFLAGS _IOW('f', 2, int)
++#define FS_IOC32_GETVERSION _IOR('v', 1, int)
++#define FS_IOC32_SETVERSION _IOW('v', 2, int)
++#else
+ #include <linux/fs.h>
++#endif
+ #include <linux/fd.h>
+ #if defined(CONFIG_FIEMAP)
+ #include <linux/fiemap.h>
+--- a/meson.build
++++ b/meson.build
+@@ -1963,6 +1963,8 @@ config_host_data.set('HAVE_OPTRESET',
+ cc.has_header_symbol('getopt.h', 'optreset'))
+ config_host_data.set('HAVE_IPPROTO_MPTCP',
+ cc.has_header_symbol('netinet/in.h', 'IPPROTO_MPTCP'))
++config_host_data.set('HAVE_SYS_MOUNT_FSCONFIG',
++ cc.has_header_symbol('sys/mount.h', 'FSCONFIG_SET_FLAG'))
+
+ # has_member
+ config_host_data.set('HAVE_SIGEV_NOTIFY_THREAD_ID',
diff --git a/app-emulation/qemu/qemu-7.0.0-r3.ebuild b/app-emulation/qemu/qemu-7.0.0-r3.ebuild
index d79b2ecdb29b..09762b74b160 100644
--- a/app-emulation/qemu/qemu-7.0.0-r3.ebuild
+++ b/app-emulation/qemu/qemu-7.0.0-r3.ebuild
@@ -300,6 +300,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-7.0.0-also-build-virtfs-proxy-helper.patch
"${FILESDIR}"/${P}-virtio-scsi-fixes.patch
"${FILESDIR}"/${P}-pci-overflow-fortify-source-3.patch
+ "${FILESDIR}"/${P}-glibc-2.36.patch
)
QA_PREBUILT="