Fix build error if compiler switch to clang
Signed-off-by: Chenxi Mao <chenxi.mao@suse.com>
This commit is contained in:
parent
2c001521fb
commit
0363135865
155
backport-meson-drop-debug_logs-configure-argument.patch
Normal file
155
backport-meson-drop-debug_logs-configure-argument.patch
Normal file
@ -0,0 +1,155 @@
|
||||
From 2b3bbbc1b7f8723c4947c6d1e4fb43cabc25fb2e Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Hrdina <phrdina@redhat.com>
|
||||
Date: Fri, 24 Jul 2020 16:30:06 +0200
|
||||
Subject: [PATCH 2/4] meson: drop debug_logs configure argument
|
||||
|
||||
There is no point of having this option in libvirt because the debug
|
||||
logs can be configured using log filters.
|
||||
|
||||
origin commit: https://gitlab.com/libvirt/libvirt/-/commit/da6d644ea7b49500680a3d4a403571234fecefad
|
||||
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
||||
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
|
||||
Signed-off-by: Chenxi Mao <chenxi.mao@suse.com>
|
||||
---
|
||||
configure.ac | 3 ---
|
||||
m4/virt-debug.m4 | 33 ---------------------------------
|
||||
src/util/virlog.h | 23 +----------------------
|
||||
tools/virsh.c | 2 --
|
||||
tools/virt-admin.c | 2 --
|
||||
5 files changed, 1 insertion(+), 62 deletions(-)
|
||||
delete mode 100644 m4/virt-debug.m4
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index cb62e5aac8..93d13496f3 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -496,7 +496,6 @@ dnl
|
||||
dnl Miscellaneous checks
|
||||
dnl
|
||||
|
||||
-LIBVIRT_ARG_DEBUG
|
||||
LIBVIRT_ARG_DTRACE
|
||||
LIBVIRT_ARG_NUMAD
|
||||
LIBVIRT_ARG_INIT_SCRIPT
|
||||
@@ -509,7 +508,6 @@ LIBVIRT_ARG_TLS_PRIORITY
|
||||
LIBVIRT_ARG_SYSCTL_CONFIG
|
||||
|
||||
|
||||
-LIBVIRT_CHECK_DEBUG
|
||||
LIBVIRT_CHECK_DTRACE
|
||||
LIBVIRT_CHECK_NUMAD
|
||||
LIBVIRT_CHECK_INIT_SCRIPT
|
||||
@@ -1038,7 +1036,6 @@ LIBVIRT_RESULT([Coverage], [$enable_test_coverage])
|
||||
AC_MSG_NOTICE([])
|
||||
AC_MSG_NOTICE([Miscellaneous])
|
||||
AC_MSG_NOTICE([])
|
||||
-LIBVIRT_RESULT_DEBUG
|
||||
LIBVIRT_RESULT([Use -Werror], [$enable_werror])
|
||||
LIBVIRT_RESULT([Warning Flags], [$WARN_CFLAGS])
|
||||
LIBVIRT_RESULT_DTRACE
|
||||
diff --git a/m4/virt-debug.m4 b/m4/virt-debug.m4
|
||||
deleted file mode 100644
|
||||
index d3ac0564f2..0000000000
|
||||
--- a/m4/virt-debug.m4
|
||||
+++ /dev/null
|
||||
@@ -1,33 +0,0 @@
|
||||
-dnl The debug check
|
||||
-dnl
|
||||
-dnl Copyright (C) 2016 Red Hat, Inc.
|
||||
-dnl
|
||||
-dnl This library is free software; you can redistribute it and/or
|
||||
-dnl modify it under the terms of the GNU Lesser General Public
|
||||
-dnl License as published by the Free Software Foundation; either
|
||||
-dnl version 2.1 of the License, or (at your option) any later version.
|
||||
-dnl
|
||||
-dnl This library is distributed in the hope that it will be useful,
|
||||
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
-dnl Lesser General Public License for more details.
|
||||
-dnl
|
||||
-dnl You should have received a copy of the GNU Lesser General Public
|
||||
-dnl License along with this library. If not, see
|
||||
-dnl <http://www.gnu.org/licenses/>.
|
||||
-dnl
|
||||
-
|
||||
-AC_DEFUN([LIBVIRT_ARG_DEBUG], [
|
||||
- LIBVIRT_ARG_ENABLE([DEBUG], [enable debugging output], [yes])
|
||||
-])
|
||||
-
|
||||
-AC_DEFUN([LIBVIRT_CHECK_DEBUG], [
|
||||
- AM_CONDITIONAL([ENABLE_DEBUG], test x"$enable_debug" = x"yes")
|
||||
- if test x"$enable_debug" = x"yes"; then
|
||||
- AC_DEFINE([ENABLE_DEBUG], [], [whether debugging is enabled])
|
||||
- fi
|
||||
-])
|
||||
-
|
||||
-AC_DEFUN([LIBVIRT_RESULT_DEBUG], [
|
||||
- LIBVIRT_RESULT([Debug], [$enable_debug])
|
||||
-])
|
||||
diff --git a/src/util/virlog.h b/src/util/virlog.h
|
||||
index feb2f85904..716fb9a378 100644
|
||||
--- a/src/util/virlog.h
|
||||
+++ b/src/util/virlog.h
|
||||
@@ -78,29 +78,8 @@ struct _virLogSource {
|
||||
.serial = 0, \
|
||||
}
|
||||
|
||||
-/*
|
||||
- * If configured with --enable-debug=yes then library calls
|
||||
- * are printed to stderr for debugging or to an appropriate channel
|
||||
- * defined at runtime from the libvirt daemon configuration file
|
||||
- */
|
||||
-#ifdef ENABLE_DEBUG
|
||||
-# define VIR_DEBUG_INT(src, filename, linenr, funcname, ...) \
|
||||
+#define VIR_DEBUG_INT(src, filename, linenr, funcname, ...) \
|
||||
virLogMessage(src, VIR_LOG_DEBUG, filename, linenr, funcname, NULL, __VA_ARGS__)
|
||||
-#else
|
||||
-/**
|
||||
- * virLogEatParams:
|
||||
- *
|
||||
- * Do nothing but eat parameters.
|
||||
- */
|
||||
-static inline void virLogEatParams(virLogSourcePtr unused, ...)
|
||||
-{
|
||||
- /* Silence gcc */
|
||||
- unused = unused;
|
||||
-}
|
||||
-# define VIR_DEBUG_INT(src, filename, linenr, funcname, ...) \
|
||||
- virLogEatParams(src, filename, linenr, funcname, __VA_ARGS__)
|
||||
-#endif /* !ENABLE_DEBUG */
|
||||
-
|
||||
#define VIR_INFO_INT(src, filename, linenr, funcname, ...) \
|
||||
virLogMessage(src, VIR_LOG_INFO, filename, linenr, funcname, NULL, __VA_ARGS__)
|
||||
#define VIR_WARN_INT(src, filename, linenr, funcname, ...) \
|
||||
diff --git a/tools/virsh.c b/tools/virsh.c
|
||||
index 197a90636d..06ff5e8336 100644
|
||||
--- a/tools/virsh.c
|
||||
+++ b/tools/virsh.c
|
||||
@@ -614,9 +614,7 @@ virshShowVersion(vshControl *ctl G_GNUC_UNUSED)
|
||||
#ifdef WITH_SECRETS
|
||||
vshPrint(ctl, " Secrets");
|
||||
#endif
|
||||
-#ifdef ENABLE_DEBUG
|
||||
vshPrint(ctl, " Debug");
|
||||
-#endif
|
||||
#ifdef WITH_DTRACE_PROBES
|
||||
vshPrint(ctl, " DTrace");
|
||||
#endif
|
||||
diff --git a/tools/virt-admin.c b/tools/virt-admin.c
|
||||
index a8e5e0a5af..df23330ee1 100644
|
||||
--- a/tools/virt-admin.c
|
||||
+++ b/tools/virt-admin.c
|
||||
@@ -1277,9 +1277,7 @@ vshAdmShowVersion(vshControl *ctl G_GNUC_UNUSED)
|
||||
#ifdef WITH_LIBVIRTD
|
||||
vshPrint(ctl, " Daemon");
|
||||
#endif
|
||||
-#ifdef ENABLE_DEBUG
|
||||
vshPrint(ctl, " Debug");
|
||||
-#endif
|
||||
#if WITH_READLINE
|
||||
vshPrint(ctl, " Readline");
|
||||
#endif
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -0,0 +1,67 @@
|
||||
From f6c9bb6adbee8f74172707845dcdf221e79e35d4 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Krempa <pkrempa@redhat.com>
|
||||
Date: Tue, 23 Aug 2022 15:29:43 +0200
|
||||
Subject: [PATCH 1/4] virhostcpu: Fix build with clang and newest kernel
|
||||
headers
|
||||
|
||||
The most recent environment e.g. present in our Fedora Rawhide builds
|
||||
fail to build the tree with clang with the following error:
|
||||
|
||||
../src/util/virhostcpu.c:1291:25: error: field 'header' with variable sized type 'struct kvm_msrs' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end]
|
||||
struct kvm_msrs header;
|
||||
^
|
||||
|
||||
The problem seems to be that clang doesn't like the new way the
|
||||
'entries' field in struct kvm_msrs is declared.
|
||||
|
||||
To work around the issue we can simply allocate the variable dynamically
|
||||
and use the 'entries' member as it was intended to to access the
|
||||
members.
|
||||
|
||||
origin commit: https://gitlab.com/libvirt/libvirt/-/commit/56b3ee743916c8951a32a1650616621d78afe8c7
|
||||
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Signed-off-by: Chenxi Mao <chenxi.mao@suse.com>
|
||||
---
|
||||
src/util/virhostcpu.c | 15 ++++++---------
|
||||
1 file changed, 6 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c
|
||||
index ce3da7e6ec..8c8fc3a476 100644
|
||||
--- a/src/util/virhostcpu.c
|
||||
+++ b/src/util/virhostcpu.c
|
||||
@@ -1275,25 +1275,22 @@ virHostCPUGetMSRFromKVM(unsigned long index,
|
||||
uint64_t *result)
|
||||
{
|
||||
VIR_AUTOCLOSE fd = -1;
|
||||
- struct {
|
||||
- struct kvm_msrs header;
|
||||
- struct kvm_msr_entry entry;
|
||||
- } msr = {
|
||||
- .header = { .nmsrs = 1 },
|
||||
- .entry = { .index = index },
|
||||
- };
|
||||
+ g_autofree struct kvm_msrs *msr = g_malloc0(sizeof(struct kvm_msrs) +
|
||||
+ sizeof(struct kvm_msr_entry));
|
||||
+ msr->nmsrs = 1;
|
||||
+ msr->entries[0].index = index;
|
||||
|
||||
if ((fd = open(KVM_DEVICE, O_RDONLY)) < 0) {
|
||||
virReportSystemError(errno, _("Unable to open %s"), KVM_DEVICE);
|
||||
return -1;
|
||||
}
|
||||
|
||||
- if (ioctl(fd, KVM_GET_MSRS, &msr) < 0) {
|
||||
+ if (ioctl(fd, KVM_GET_MSRS, msr) < 0) {
|
||||
VIR_DEBUG("Cannot get MSR 0x%lx from KVM", index);
|
||||
return 1;
|
||||
}
|
||||
|
||||
- *result = msr.entry.data;
|
||||
+ *result = msr->entries[0].data;
|
||||
return 0;
|
||||
}
|
||||
|
||||
--
|
||||
2.33.0
|
||||
|
||||
42
backport-vshCommandStringGetArg-Drop-sz.patch
Normal file
42
backport-vshCommandStringGetArg-Drop-sz.patch
Normal file
@ -0,0 +1,42 @@
|
||||
From 6d3c4b49c08d5fcf42f324af0d04551619e4109f Mon Sep 17 00:00:00 2001
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Thu, 7 Jan 2021 17:59:55 +0100
|
||||
Subject: [PATCH 3/4] vshCommandStringGetArg: Drop @sz
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This variable is unused since introduction of the function in
|
||||
v0.8.5~150.
|
||||
|
||||
origin commit: https://gitlab.com/libvirt/libvirt/-/commit/9b9542586cc047075469053606d1e12cb017b5ca
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
Signed-off-by: Chenxi Mao <chenxi.mao@suse.com>
|
||||
---
|
||||
tools/vsh.c | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
diff --git a/tools/vsh.c b/tools/vsh.c
|
||||
index 3646f37cea..f5fa7b6f6f 100644
|
||||
--- a/tools/vsh.c
|
||||
+++ b/tools/vsh.c
|
||||
@@ -1641,7 +1641,6 @@ vshCommandStringGetArg(vshControl *ctl, vshCommandParser *parser, char **res,
|
||||
{
|
||||
bool single_quote = false;
|
||||
bool double_quote = false;
|
||||
- int sz = 0;
|
||||
char *p = parser->pos;
|
||||
char *q = g_strdup(p);
|
||||
|
||||
@@ -1695,7 +1694,6 @@ vshCommandStringGetArg(vshControl *ctl, vshCommandParser *parser, char **res,
|
||||
}
|
||||
|
||||
*q++ = *p++;
|
||||
- sz++;
|
||||
}
|
||||
if (double_quote) {
|
||||
if (report)
|
||||
--
|
||||
2.33.0
|
||||
|
||||
30
bugfix-fix-warnings-found-by-clang.patch
Normal file
30
bugfix-fix-warnings-found-by-clang.patch
Normal file
@ -0,0 +1,30 @@
|
||||
From 0559dfd4d4fa74484dae487711a986cc9acdfbfc Mon Sep 17 00:00:00 2001
|
||||
From: Chenxi Mao <chenxi.mao@suse.com>
|
||||
Date: Tue, 4 Apr 2023 14:25:17 +0800
|
||||
Subject: [PATCH 4/4] Fix warnings found by clang
|
||||
|
||||
Warnings found if build with clang 15:
|
||||
|
||||
[ 257s] ../../src/qemu/qemu_hotpatch.c:217:22: error: unused variable 'libvirtd_conf' [-Werror,-Wunused-variable]
|
||||
[ 257s] g_autofree char *libvirtd_conf = NULL;
|
||||
|
||||
Signed-off-by: Chenxi Mao <chenxi.mao@suse.com>
|
||||
---
|
||||
src/qemu/qemu_hotpatch.c | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_hotpatch.c b/src/qemu/qemu_hotpatch.c
|
||||
index 02f511cc38..64aac9bb4c 100644
|
||||
--- a/src/qemu/qemu_hotpatch.c
|
||||
+++ b/src/qemu/qemu_hotpatch.c
|
||||
@@ -214,7 +214,6 @@ qemuDomainHotpatchAutoload(virDomainObjPtr vm, char *hotpatch_path)
|
||||
VIR_AUTOSTRINGLIST applied_patches = NULL;
|
||||
VIR_AUTOSTRINGLIST lines = NULL;
|
||||
g_autofree char *applied_patch = NULL;
|
||||
- g_autofree char *libvirtd_conf = NULL;
|
||||
g_autofree char *patch_conf = NULL;
|
||||
g_autofree char *buf = NULL;
|
||||
char *ret = NULL;
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -101,7 +101,7 @@
|
||||
Summary: Library providing a simple virtualization API
|
||||
Name: libvirt
|
||||
Version: 6.2.0
|
||||
Release: 53
|
||||
Release: 54
|
||||
License: LGPLv2+
|
||||
URL: https://libvirt.org/
|
||||
|
||||
@ -473,6 +473,10 @@ Patch0360: Add-loongarch-cpu-support.patch
|
||||
Patch0361: Add-loongarch-cpu-model-and-vendor-info.patch
|
||||
Patch0362: Config-some-capabilities-for-loongarch-virt-machine.patch
|
||||
Patch0363: Implement-the-method-of-getting-host-info-for-loonga.patch
|
||||
Patch0364: backport-virhostcpu-Fix-build-with-clang-and-newest-kernel-he.patch
|
||||
Patch0365: backport-meson-drop-debug_logs-configure-argument.patch
|
||||
Patch0366: backport-vshCommandStringGetArg-Drop-sz.patch
|
||||
Patch0367: bugfix-fix-warnings-found-by-clang.patch
|
||||
|
||||
Requires: libvirt-daemon = %{version}-%{release}
|
||||
Requires: libvirt-daemon-config-network = %{version}-%{release}
|
||||
@ -2209,6 +2213,9 @@ exit 0
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Apr 04 2023 Chenxi Mao <chenxi.mao@suse.com> - 6.2.0-54
|
||||
- bugfix: Fix build error if compiler switch to clang.
|
||||
|
||||
* Thu Mar 30 2023 zhaotianrui <zhaotianrui@loongson.cn> - 6.2.0-53
|
||||
- bugfix: correct the firmware path of loongarch virt machine
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user