Fix build with glibc 2.36

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2022-08-01 15:35:19 -04:00
parent 24d349fa37
commit 417e4c9cf7
3 changed files with 75 additions and 0 deletions

View File

@ -0,0 +1,34 @@
From de63f9ca622e25df97ca926d7e409d074499fcf6 Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Mon, 1 Aug 2022 15:20:38 -0400
Subject: [PATCH] lxc: containter: fix build with glibc 2.36
Content-type: text/plain
With glibc 2.36, sys/mount.h and linux/mount.h conflict:
https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3E_and_.3Csys.2Fmount.h.3E
lxc_container.c imports sys/mount.h and linux/fs.h, which pulls in
linux/mount.h.
linux/fs.h isn't required here though. glibc sys/mount.h has had
MS_MOVE since 2.12 in 2010
Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
src/lxc/lxc_container.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index b5278831da..a5401c2186 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -33,9 +33,6 @@
/* Yes, we want linux private one, for _syscall2() macro */
#include <linux/unistd.h>
-/* For MS_MOVE */
-#include <linux/fs.h>
-
#if WITH_CAPNG
# include <cap-ng.h>
#endif

View File

@ -0,0 +1,37 @@
From 3b6a3cfd76832efd504bb3e868675e0f27e16c3a Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Mon, 1 Aug 2022 15:24:01 -0400
Subject: [PATCH] virfile: Fix build with glibc 2.36
Content-type: text/plain
With glibc 2.36, sys/mount.h and linux/mount.h conflict:
https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3E_and_.3Csys.2Fmount.h.3E
virfile.c imports sys/mount.h and linux/fs.h, which pulls in
linux/mount.h.
Manually define the constants we need from linux/fs.h, like was
done in llvm:
https://reviews.llvm.org/rGb379129c4beb3f26223288627a1291739f33af02
Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
src/util/virfile.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/util/virfile.c b/src/util/virfile.c
index 99da058db3..65d6d2a701 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -71,7 +71,9 @@
# endif
# include <sys/ioctl.h>
# include <linux/cdrom.h>
-# include <linux/fs.h>
+# define FS_IOC_GETFLAGS _IOR('f', 1, long)
+# define FS_IOC_SETFLAGS _IOR('f', 2, long)
+# define FS_NOCOW_FL 0x00800000
#endif
#if WITH_LIBATTR

View File

@ -240,6 +240,10 @@ URL: https://libvirt.org/
%endif
Source: https://libvirt.org/sources/%{?mainturl}libvirt-%{version}.tar.xz
# Fix build with glibc 2.36
Patch0001: 0001-lxc-containter-fix-build-with-glibc-2.36.patch
Patch0002: 0002-virfile-Fix-build-with-glibc-2.36.patch
Requires: libvirt-daemon = %{version}-%{release}
Requires: libvirt-daemon-config-network = %{version}-%{release}
Requires: libvirt-daemon-config-nwfilter = %{version}-%{release}