Misc changes to allow building with Windows Clang
cover Misc changes to allow building with Windows Clang
This is the first set of changes to allow building qemu-ga with Microsoft Windows Clang. It includes some cleanups and fixes that also make the code more portable. The main goal is to be able to build qemu-ga with the MSVC toolchain because MinGW-w64 is not available for ARM64 Windows.
These changes were tested on CentOS Stream, Arch Linux, FreeBSD, NetBSD. Full QEMU tree was compiled without any issues on all these platforms.
The full set of changes consists of about fifteen more patches. Once that is complete, I will add documentation on how to build qemu-ga with MSVC clang and a CI job that tests it.
Kostiantyn Kostiuk (6):
meson: Use stddef.h instead of unistd.h
qom: Use g_ascii_strcasecmp instead of strcasecmp
osdep: Remove unused strings.h
Remove unused dirent.h
Remove unused sys/param.h
meson: Build block_syms and qemu_syms only when enable_modules
Paolo Bonzini (1):
storage-daemon: use same link arguments as other tools
include/qemu/osdep.h | 1 - meson.build | 35 +++++++++++++++++++---------------- qom/object.c | 4 ++-- storage-daemon/meson.build | 16 ++++++++-------- util/drm.c | 1 - util/path.c | 2 -- 6 files changed, 29 insertions(+), 30 deletions(-)
--
2.52.0
PATCH 1/7 meson: Use stddef.h instead of unistd.h
This is more cross-platform way.
--- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meson.build +1 -1
@@ -1060,7 +1060,7 @@ endif if not cc.compiles(''' #include <glib.h> - #include <unistd.h> + #include <stddef.h> #define QEMU_BUILD_BUG_ON(x) \ typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused));
Signature · 1 line
2.52.0
Re: [PATCH 1/7] meson: Use stddef.h instead of unistd.h
Quoted 13 lines · Kostiantyn Kostiuk
This is more cross-platform way.
Signed-off-by Kostiantyn Kostiuk <[email protected]>--- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)meson.build +0
-0
meson.build endif · line 1063
Quoted 5 lines
meson.build +1
-1@@ -1060,7 +1060,7 @@ endif if not cc.compiles(''' #include <glib.h> - #include <unistd.h> + #include <stddef.h>
POSIX says stddef.h provides size_t, which is the only thing we care about here. (But it also says that unistd.h provides it, so your platform is broken.)
This is the kind of detail that should be in the commit message:
you need to explain why it is OK to make the change and why the previous code is wrong.
thanks
-- PMM
Re: [PATCH 1/7] meson: Use stddef.h instead of unistd.h
Il gio 26 mar 2026, 17:34 Peter Maydell <[email protected]> ha scritto:
Quoted 4 lines
POSIX says
stddef.hprovidessize_t, which is the only thing we care about here. (But it also says thatunistd.hprovides it, so your platform is broken.)
It's not POSIX to begin with. :) There are other small differences between MSVC and Mingw runtimes but the main one is exactly that it doesn't have unistd.h at all.
Having taken a peek at the full set of changes needed to build qemu-ga with MSVC runtime, most of them are cleanups like these ones that (review comments aside) make sense on their own anyway. In some cases... a bit less.
Paolo
This is the kind of detail that should be in the commit message:
Quoted 9 lines
you need to explain why it is OK to make the change and why the previous code is wrong.
Reviewed-by Peter Maydell <[email protected]>thanks
-- PMM
PATCH 2/7 qom: Use g_ascii_strcasecmp instead of strcasecmp
In reply to Kostiantyn Kostiuk--- qom/object.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
qom/object.c +2 -2
@@ -1193,8 +1193,8 @@ GSList *object_class_get_list(const char *implements_type,static gint object_class_cmp (gconstpointer a,gconstpointer b,gpointer d) { -return strcasecmp (object_class_get_name ((ObjectClass *)a), -object_class_get_name ((ObjectClass *)b)); +return g_ascii_strcasecmp (object_class_get_name ((ObjectClass *)a), +object_class_get_name ((ObjectClass *)b)); } GSList *object_class_get_list_sorted(const char *implements_type,
Signature · 1 line
2.52.0
Re: [PATCH 2/7] qom: Use g_ascii_strcasecmp instead of strcasecmp
Quoted 11 lines · Kostiantyn Kostiuk
Signed-off-by Kostiantyn Kostiuk <[email protected]>--- qom/object.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)qom/object.c +0
-0
qom/object.c GSList *object_class_get_list(const char *implements_type, · line 1198
Quoted 8 lines
qom/object.c +2
-2@@ -1193,8 +1193,8 @@ GSList *object_class_get_list(const char *implements_type,static gint object_class_cmp (gconstpointer a,gconstpointer b,gpointer d) { -return strcasecmp (object_class_get_name ((ObjectClass *)a), -object_class_get_name ((ObjectClass *)b)); +return g_ascii_strcasecmp (object_class_get_name ((ObjectClass *)a), +object_class_get_name ((ObjectClass *)b)); }
The commit message should note that this is a change in semantics (g_ascii_strcasecmp() doesn't honour locale but strcasecmp() does) but that this is OK for two reasons:
(1) we want the comparison on class names to be a plain ASCII one, not to do weird things with "I" in Turkish locales, so g_ascii_strcasecmp() is better as it's explicit about that
(2) QEMU always runs with the C locale so there's not an actual behaviour change here
(I forgot about point (2) in my email on the other branch of this thread -- apologies for the confusion.)
-- PMM
PATCH 3/7 osdep: Remove unused strings.h
In reply to Kostiantyn Kostiuk--- include/qemu/osdep.h | 1 - 1 file changed, 1 deletion(-)
include/qemu/osdep.h +0 -1
@@ -114,7 +114,6 @@ QEMU_EXTERN_C int daemon(int, int);#include <stdio.h> #include <string.h> -#include <strings.h> #include <inttypes.h> #include <limits.h> /* Put unistd.h before time.h as that triggers localtime_r/gmtime_r
Signature · 1 line
2.52.0
Re: [PATCH 3/7] osdep: Remove unused strings.h
Quoted 11 lines · Kostiantyn Kostiuk
Signed-off-by Kostiantyn Kostiuk <[email protected]>--- include/qemu/osdep.h | 1 - 1 file changed, 1 deletion(-)include/qemu/osdep.h +0
-0
include/qemu/osdep.h QEMU_EXTERN_C int daemon(int, int); · line 119
Quoted 7 lines
include/qemu/osdep.h +0
-1@@ -114,7 +114,6 @@ QEMU_EXTERN_C int daemon(int, int);#include <stdio.h> #include <string.h> -#include <strings.h> #include <inttypes.h> #include <limits.h> /* Put unistd.h before time.h as that triggers localtime_r/gmtime_r
This needs more rationale about why we can drop the header. POSIX says it brings in ffs(), strncasecmp_l() and strcasecmp_l(), which we don't use, but also strcasecmp() and strncasecmp() which we definitely do use.
Some libcs (notably glibc) may also define those in string.h, but the manpage says that's a backward-compatibility thing, so we shouldn't rely on it.
-- PMM
Re: [PATCH 3/7] osdep: Remove unused strings.h
Quoted 15 lines · Peter Maydell
Quoted 13 lines · Kostiantyn Kostiuk
Signed-off-by Kostiantyn Kostiuk <[email protected]>--- include/qemu/osdep.h | 1 - 1 file changed, 1 deletion(-)include/qemu/osdep.h +0
-0@@ -114,7 +114,6 @@ QEMU_EXTERN_C int daemon(int, int);#include <stdio.h>
Quoted 11 lines
include/qemu/osdep.h QEMU_EXTERN_C int daemon(int, int); · line 119
Quoted 5 lines
include/qemu/osdep.h +0
-1#include <string.h> -#include <strings.h> #include <inttypes.h> #include <limits.h> /* Put unistd.h before time.h as that triggers localtime_r/gmtime_r This needs more rationale about why we can drop the header. POSIX says it brings in
ffs(),strncasecmp_l()andstrcasecmp_l(), which we don't use, but alsostrcasecmp()andstrncasecmp()which we definitely do use.
Will be ok if I replace strcasecmp with g_ascii_strcasecmp (and other functions)
in the full QEMU tree?
Currently, I see in QEMU we have a mix of strcasecmp/g_ascii_strcasecmp. In some places we use glb2, in some libc.
Quoted 7 lines
Some libcs (notably glibc) may also define those in
string.h, but the manpage says that's a backward-compatibility thing, so we shouldn't rely on it.-- PMM
Re: [PATCH 3/7] osdep: Remove unused strings.h
Quoted 33 lines · Kostiantyn Kostiuk
Quoted 15 lines · Peter Maydell
Quoted 13 lines · Kostiantyn Kostiuk
Signed-off-by Kostiantyn Kostiuk <[email protected]>--- include/qemu/osdep.h | 1 - 1 file changed, 1 deletion(-)include/qemu/osdep.h +0
-0@@ -114,7 +114,6 @@ QEMU_EXTERN_C int daemon(int, int);#include <stdio.h> Quoted 10 lines
include/qemu/osdep.h QEMU_EXTERN_C int daemon(int, int); · line 119
Quoted 5 lines
include/qemu/osdep.h +0
-1#include <string.h> -#include <strings.h> #include <inttypes.h> #include <limits.h> /* Put unistd.h before time.h as that triggers localtime_r/gmtime_r This needs more rationale about why we can drop the header. POSIX says it brings in
ffs(),strncasecmp_l()andstrcasecmp_l(), which we don't use, but alsostrcasecmp()andstrncasecmp()which we definitely do use.
Quoted 5 lines
Will be ok if I replace strcasecmp with
g_ascii_strcasecmp(and other functions) in the full QEMU tree?Currently, I see in QEMU we have a mix of strcasecmp/g_ascii_strcasecmp. In some places we use glb2, in some libc.
Yes, it would be OK, but we need to be a bit careful, because strcasecmp() and g_ascii_strcasecmp() aren't identical; the former honours locale and the latter is a pure ASCII comparison. So we need to check that that's what we want. A quick look at the grep results suggests that in fact we really do want an ASCII comparison in all these places (and the locale stuff in strcasecmp can be a source of bugs, as noted e.g. here:
https://daniel.haxx.se/blog/2008/10/15/strcasecmp-in-turkish/ ); but it does need a little bit of a check of the context where the functions are used. Where we're doing something like "check this input value matches 'off'" this is a code cleanup regardless of portability requirements.
thanks
-- PMM
Re: [PATCH 3/7] osdep: Remove unused strings.h
Quoted 44 lines · Peter Maydell
Quoted 6 lines · Kostiantyn Kostiuk
On Thu, Mar 26, 2026 at 6:20 PM Peter Maydell <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
On Thu, 26 Mar 2026 at 16:02, Kostiantyn Kostiuk <[email protected]>
Quoted 25 lines · wrote:
Quoted 13 lines
Quoted 13 lines
Signed-off-by Kostiantyn Kostiuk <[email protected]>--- include/qemu/osdep.h | 1 - 1 file changed, 1 deletion(-)include/qemu/osdep.h +0
-0@@ -114,7 +114,6 @@ QEMU_EXTERN_C int daemon(int, int);#include <stdio.h> Quoted 10 lines
include/qemu/osdep.h QEMU_EXTERN_C int daemon(int, int); · line 119
Quoted 5 lines
include/qemu/osdep.h +0
-1#include <string.h> -#include <strings.h> #include <inttypes.h> #include <limits.h> /* Put unistd.h before time.h as that triggers localtime_r/gmtime_r This needs more rationale about why we can drop the header. POSIX says it brings in
ffs(),strncasecmp_l()andstrcasecmp_l(), which we don't use, but alsostrcasecmp()andstrncasecmp()which we definitely do use.Quoted 1 line
Will be ok if I replace strcasecmp with
g_ascii_strcasecmp(and otherfunctions)
Quoted 4 lines
in the full QEMU tree?
Currently, I see in QEMU we have a mix of strcasecmp/g_ascii_strcasecmp. In some places we use glb2, in some libc.
Quoted 14 lines
Yes, it would be OK, but we need to be a bit careful, because
strcasecmp()andg_ascii_strcasecmp()aren't identical; the former honours locale and the latter is a pure ASCII comparison. So we need to check that that's what we want. A quick look at the grep results suggests that in fact we really do want an ASCII comparison in all these places (and the locale stuff in strcasecmp can be a source of bugs, as noted e.g. here:
https://daniel.haxx.se/blog/2008/10/15/strcasecmp-in-turkish/ ); but it does need a little bit of a check of the context where the functions are used. Where we're doing something like "check this input value matches 'off'" this is a code cleanup regardless of portability requirements.
Is this ok to update several strcasecmp usage in one commit, or better to split it per component?
Quoted 4 lines
thanks
-- PMM
Re: [PATCH 3/7] osdep: Remove unused strings.h
Quoted 26 lines · Kostiantyn Kostiuk
Quoted 8 lines · Peter Maydell
Quoted 5 lines · Kostiantyn Kostiuk
Will be ok if I replace strcasecmp with
g_ascii_strcasecmp(and other functions) in the full QEMU tree?Currently, I see in QEMU we have a mix of strcasecmp/g_ascii_strcasecmp. In some places we use glb2, in some libc.
Quoted 13 lines
Yes, it would be OK, but we need to be a bit careful, because
strcasecmp()andg_ascii_strcasecmp()aren't identical; the former honours locale and the latter is a pure ASCII comparison. So we need to check that that's what we want. A quick look at the grep results suggests that in fact we really do want an ASCII comparison in all these places (and the locale stuff in strcasecmp can be a source of bugs, as noted e.g. here:
https://daniel.haxx.se/blog/2008/10/15/strcasecmp-in-turkish/ ); but it does need a little bit of a check of the context where the functions are used. Where we're doing something like "check this input value matches 'off'" this is a code cleanup regardless of portability requirements.
Quoted 2 lines
Is this ok to update several strcasecmp usage in one commit, or better to split it per component?
I think I would split it per component, because the people who might care about it are different in each case.
-- PMM
PATCH 4/7 Remove unused dirent.h
In reply to Kostiantyn Kostiuk--- util/drm.c | 1 - util/path.c | 1 - 2 files changed, 2 deletions(-)
util/drm.c +0 -1
@@ -18,7 +18,6 @@#include "qemu/drm.h" #include <glob.h> -#include <dirent.h> int qemu_drm_rendernode_open (const char *rendernode) {
util/path.c +0 -1
@@ -5,7 +5,6 @@*/ #include "qemu/osdep.h" #include <sys/param.h> -#include <dirent.h> #include "qemu/cutils.h" #include "qemu/path.h" #include "qemu/thread.h"
Signature · 1 line
2.52.0
Re: [PATCH 4/7] Remove unused dirent.h
Quoted 12 lines · Kostiantyn Kostiuk
Signed-off-by Kostiantyn Kostiuk <[email protected]>--- util/drm.c | 1 - util/path.c | 1 - 2 files changed, 2 deletions(-)util/drm.c +0
-0
util/drm.c line 23
Quoted 7 lines
util/drm.c +0
-1@@ -18,7 +18,6 @@#include "qemu/drm.h" #include <glob.h> -#include <dirent.h> int qemu_drm_rendernode_open (const char *rendernode) {
This file uses opendir()/readdir()/closedir(), all of which are specified to be brought in by <dirent.h>, so we can't drop this include.
util/path.c line 10
Quoted 12 lines
util/path.c +0
-1@@ -5,7 +5,6 @@*/ #include "qemu/osdep.h" #include <sys/param.h> -#include <dirent.h> #include "qemu/cutils.h" #include "qemu/path.h" #include "qemu/thread.h"
This one is OK to drop, because the rewrite of path.c in commit f3a8bdc1d5b26 removed the uses of the dirent.h functions.
thanks
-- PMM
Re: [PATCH 4/7] Remove unused dirent.h
Quoted 10 lines · Peter Maydell
Quoted 6 lines
#include <
glob.h>
-#include <dirent.h>int qemu_drm_rendernode_open(const char *rendernode) {This file uses opendir()/readdir()/closedir(), all of which are specified to be brought in by <
dirent.h>, so we can't drop this include.
It's also compiled only if host_os != 'windows', so it doesn't matter for the purpose of compiling qemu-ga with MSVC/clang-cl.
Paolo
PATCH 5/7 Remove unused sys/param.h
In reply to Kostiantyn Kostiuk--- util/path.c | 1 - 1 file changed, 1 deletion(-)
util/path.c +0 -1
@@ -4,7 +4,6 @@The assumption is that this area does not change. */ #include "qemu/osdep.h" -#include <sys/param.h> #include "qemu/cutils.h" #include "qemu/path.h" #include "qemu/thread.h"
Signature · 1 line
2.52.0
Re: [PATCH 5/7] Remove unused sys/param.h
Quoted 11 lines · Kostiantyn Kostiuk
Signed-off-by Kostiantyn Kostiuk <[email protected]>--- util/path.c | 1 - 1 file changed, 1 deletion(-)util/path.c +0
-0
util/path.c line 9
Quoted 7 lines
util/path.c +0
-1@@ -4,7 +4,6 @@The assumption is that this area does not change. */ #include "qemu/osdep.h" -#include <sys/param.h> #include "qemu/cutils.h" #include "qemu/path.h" #include "qemu/thread.h"
We dropped the use of PATH_MAX in commit f3a8bdc1d5b26 (which basically completely rewrote the path handling); I think that was likely why we wanted param.h.
thanks
-- PMM
Re: [PATCH 5/7] Remove unused sys/param.h
Hi Peter,
This is a very old commit. I tested removing sys/param.h based on 512b794b109 (Update version for v11.0.0-rc1 release).
The full QEMU tree was compiled successfully, so I am not sure why we need it.
Best Regards,
Kostiantyn Kostiuk.
Quoted 31 lines · Peter Maydell
Quoted 11 lines · Kostiantyn Kostiuk
Signed-off-by Kostiantyn Kostiuk <[email protected]>--- util/path.c | 1 - 1 file changed, 1 deletion(-)util/path.c +0
-0util/path.c line 9
Quoted 7 lines
util/path.c +0
-1@@ -4,7 +4,6 @@The assumption is that this area does not change. */ #include "qemu/osdep.h" -#include <sys/param.h> #include "qemu/cutils.h" #include "qemu/path.h" #include "qemu/thread.h" We dropped the use of
PATH_MAXin commitf3a8bdc1d5b26(which basically completely rewrote the path handling); I think that was likely why we wantedparam.h.Reviewed-by Peter Maydell <[email protected]>thanks
-- PMM
Re: [PATCH 5/7] Remove unused sys/param.h
Quoted 5 lines · Kostiantyn Kostiuk
Hi Peter,
This is a very old commit. I tested removing
sys/param.hbased on512b794b109(Update version for v11.0.0-rc1 release). The full QEMU tree was compiled successfully, so I am not sure why we need it.
Note that "it compiled OK" is not a 100% reliable way to check for "do we need this include?". For historical and backwards-compatibility reasons, the glibc headers have various places where one header might pull in another. The glibc developers have in the past done cleanup work where they fix that kind of thing so you only get the function definition when you include the header that the standards say you need for that function; it's quite plausible they might do that again in future. So the best approach is to check the POSIX spec etc to see which header it says you need to include, and include that one.
-- PMM
PATCH 6/7 storage-daemon: use same link arguments as other tools
In reply to Kostiantyn KostiukFrom: Paolo Bonzini <[email protected]>
--- meson.build | 8 ++++---- storage-daemon/meson.build | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-)
meson.build +4 -4
@@ -4496,15 +4496,15 @@ if xkbcommon.found() endif if have_tools - link_args = enable_modules ? ['@block.syms'] : [] + tools_link_args = enable_modules ? ['@block.syms'] : [] qemu_img = executable('qemu-img', [files('qemu-img.c'), hxdep], - link_args: link_args, link_depends: block_syms, + link_args: tools_link_args, link_depends: block_syms, dependencies: [authz, block, crypto, io, qom, qemuutil], install: true) qemu_io = executable('qemu-io', files('qemu-io.c'), - link_args: link_args, link_depends: block_syms, + link_args: tools_link_args, link_depends: block_syms, dependencies: [block, qemuutil], install: true) qemu_nbd = executable('qemu-nbd', files('qemu-nbd.c'), - link_args: link_args, link_depends: block_syms, + link_args: tools_link_args, link_depends: block_syms, dependencies: [blockdev, qemuutil, selinux], install: true)
storage-daemon/meson.build +8 -8
@@ -1,14 +1,14 @@ +assert(have_tools) + qsd_ss = ss.source_set() qsd_ss.add(files('qemu-storage-daemon.c')) qsd_ss.add(blockdev, chardev, qmp, qom, qemuutil) subdir('qapi') -if have_tools - qsd_ss = qsd_ss.apply({}) - qsd = executable('qemu-storage-daemon', - qsd_ss.sources(), - link_args: '@block.syms', link_depends: block_syms, - dependencies: qsd_ss.dependencies(), - install: true) -endif +qsd_ss = qsd_ss.apply({}) +qsd = executable('qemu-storage-daemon', + qsd_ss.sources(), + link_args: tools_link_args, link_depends: block_syms, + dependencies: qsd_ss.dependencies(), + install: true)
Signature · 1 line
2.52.0
Re: [PATCH 6/7] storage-daemon: use same link arguments as other tools
Am 26.03.2026 um 17:00 hat Kostiantyn Kostiuk geschrieben:
Quoted 3 lines
From: Paolo Bonzini <[email protected]>
Signed-off-by Paolo Bonzini <[email protected]>
PATCH 7/7 meson: Build block_syms and qemu_syms only when enable_modules
In reply to Kostiantyn Kostiuk--- meson.build | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
meson.build +14 -11
@@ -3897,6 +3897,9 @@ modinfo_generate = find_program('scripts/modinfo-generate.py') modinfo_files = [] audio_modinfo_files = [] +block_syms = [] +qemu_syms = [] + block_mods = [] system_mods = [] emulator_modules = []
@@ -4012,18 +4015,18 @@ if enable_modules if emulator_modules.length() > 0 alias_target('modules', emulator_modules) endif -endif -nm = find_program('nm') -undefsym = find_program('scripts/undefsym.py') -block_syms = custom_target('block.syms', output: 'block.syms', - input: [libqemuutil, block_mods], - capture: true, - command: [undefsym, nm, '@INPUT@']) -qemu_syms = custom_target('qemu.syms', output: 'qemu.syms', - input: [libqemuutil, system_mods], - capture: true, - command: [undefsym, nm, '@INPUT@']) + nm = find_program('nm') + undefsym = find_program('scripts/undefsym.py') + block_syms = custom_target('block.syms', output: 'block.syms', + input: [libqemuutil, block_mods], + capture: true, + command: [undefsym, nm, '@INPUT@']) + qemu_syms = custom_target('qemu.syms', output: 'qemu.syms', + input: [libqemuutil, system_mods], + capture: true, + command: [undefsym, nm, '@INPUT@']) +endif authz_ss = authz_ss.apply({}) libauthz = static_library('authz', authz_ss.sources() + genh,
Signature · 1 line
2.52.0
Re: [PATCH 7/7] meson: Build block_syms and qemu_syms only when enable_modules
Am 26.03.2026 um 17:00 hat Kostiantyn Kostiuk geschrieben:
Quoted 1 line
Signed-off-by Kostiantyn Kostiuk <[email protected]>
I'm not a meson expert, but the change itself looks ok to me.
However, the commit message is definitely a bit too empty. It should say why you want to make this change.
Kevin
Re: [PATCH 7/7] meson: Build block_syms and qemu_syms only when enable_modules
Quoted 7 lines · Kevin Wolf
Am 26.03.2026 um 17:00 hat Kostiantyn Kostiuk geschrieben:
Quoted 1 line
Signed-off-by Kostiantyn Kostiuk <[email protected]>I'm not a meson expert, but the change itself looks ok to me.
However, the commit message is definitely a bit too empty. It should say why you want to make this change.
Agreed, I *think* it's because scripts/undefsym.py would immediately exit here:
if len(args) <= 3:
sys.exit(0)but it should be spelled out.
Paolo
Re: [PATCH 7/7] meson: Build block_syms and qemu_syms only when enable_modules
Am 27.03.2026 um 11:47 hat Paolo Bonzini geschrieben:
Quoted 9 lines · Kevin Wolf
Quoted 7 lines
Am 26.03.2026 um 17:00 hat Kostiantyn Kostiuk geschrieben:
Quoted 1 line
Signed-off-by Kostiantyn Kostiuk <[email protected]>I'm not a meson expert, but the change itself looks ok to me.
However, the commit message is definitely a bit too empty. It should say why you want to make this change.
Quoted 7 lines
Agreed, I *think* it's because
scripts/undefsym.pywould immediately exit here:if len(args) <= 3: sys.exit(0)but it should be spelled out.
If that's a problem, why doesn't ./configure --disable-modules fail on Linux?
Kevin
Re: [PATCH 7/7] meson: Build block_syms and qemu_syms only when enable_modules
Quoted 14 lines · Kevin Wolf
Am 27.03.2026 um 11:47 hat Paolo Bonzini geschrieben:
Quoted 7 lines · Kevin Wolf
Quoted 6 lines
Am 26.03.2026 um 17:00 hat Kostiantyn Kostiuk geschrieben:
Quoted 1 line
Signed-off-by Kostiantyn Kostiuk <[email protected]>I'm not a meson expert, but the change itself looks ok to me.
However, the commit message is definitely a bit too empty. It should
say
Quoted 5 lines
Quoted 1 line
why you want to make this change.
Agreed, I *think* it's because
scripts/undefsym.pywould immediately exit here:
Quoted 8 lines
Quoted 4 lines
if len(args) <= 3: sys.exit(0)but it should be spelled out.
If that's a problem, why doesn't ./configure --disable-modules fail on Linux?
It does not fail because it exits with 0, no error. Problem in my environment because nm is missing, but at the same time, running undefsym when modules are disabled has zero sense because nothing will be generated
Quoted 4 lines
Kevin
Re: [PATCH 7/7] meson: Build block_syms and qemu_syms only when enable_modules
Am 27.03.2026 um 12:10 hat Kostiantyn Kostiuk geschrieben:
Quoted 21 lines · Kevin Wolf
Quoted 20 lines
Am 27.03.2026 um 11:47 hat Paolo Bonzini geschrieben:
Quoted 7 lines · Kevin Wolf
Quoted 6 lines
Am 26.03.2026 um 17:00 hat Kostiantyn Kostiuk geschrieben:
Quoted 1 line
Signed-off-by Kostiantyn Kostiuk <[email protected]>I'm not a meson expert, but the change itself looks ok to me.
However, the commit message is definitely a bit too empty. It should
say
Quoted 9 lines
Quoted 1 line
why you want to make this change.
Agreed, I *think* it's because
scripts/undefsym.pywould immediately exit here:if len(args) <= 3: sys.exit(0)but it should be spelled out.
Quoted 7 lines
Quoted 2 lines
If that's a problem, why doesn't ./configure --disable-modules fail on Linux?
It does not fail because it exits with 0, no error. Problem in my environment because nm is missing, but at the same time, running undefsym when modules are disabled has zero sense because nothing will be generated
Ok, makes sense. Then how about making the subject line something like "meson: Don't require nm for non-modular builds", and explaining in the commit message on which platform nm is missing and that the change is harmless because it already didn't do anything before?
Kevin
Quoted 8 lines · Kostiantyn Kostiuk
This is the first set of changes to allow building qemu-ga with Microsoft Windows Clang. It includes some cleanups and fixes that also make the code more portable. The main goal is to be able to build qemu-ga with the MSVC toolchain because MinGW-w64 is not available for ARM64 Windows.
Hello,
MinGW-w64 is available for arm64 Windows, although it’s more mature with Clang as a compiler instead of of MSVC.
Is it more of a packaging issue with distributions?
Thank you,
-Mohamed
Quoted 12 lines · Mohamed Mediouni
Quoted 9 lines · Kostiantyn Kostiuk
This is the first set of changes to allow building qemu-ga with Microsoft Windows Clang. It includes some cleanups and fixes that also make the code more portable. The main goal is to be able to build qemu-ga with the MSVC toolchain because MinGW-w64 is not available for ARM64 Windows.
Quoted 4 lines
Hello,
MinGW-w64 is available for arm64 Windows, although it’s more mature with Clang as a compiler instead of of MSVC.
Typo, meant instead of gcc
Upstream GCC also has aarch64-w64-mingw32 nowadays
For QEMU arm64 Windows builds, we currently use the aarch64-w64-mingw32 triplet with Clang.
Quoted 6 lines
Is it more of a packaging issue with distributions?
Thank you,
-Mohamed
Quoted 6 lines · Mohamed Mediouni
Quoted 2 lines
On 26. Mar 2026, at 17:00, Kostiantyn Kostiuk <[email protected]>
Quoted 2 lines · wrote:
This is the first set of changes to allow building qemu-ga with
Microsoft Windows Clang.
Quoted 8 lines
Quoted 1 line
It includes some cleanups and fixes that also make the code more
portable.
Quoted 3 lines
The main goal is to be able to build qemu-ga with the MSVC toolchain because MinGW-w64 is not available for ARM64 Windows.
Hello,
MinGW-w64 is available for arm64 Windows, although it’s more
mature with Clang as a compiler instead of of MSVC.
Quoted 1 line
I expect to use clang from the MSVC environment, not the MSVC compiler
Quoted 8 lines
Is it more of a packaging issue with distributions?
Thank you,
-Mohamed
Quoted 18 lines · Kostiantyn Kostiuk
On Thu, Mar 26, 2026 at 6:35 PM Mohamed Mediouni <[email protected] <mailto:[email protected]>> wrote:
> On 26. Mar 2026, at 17:00, Kostiantyn Kostiuk
<[email protected] <mailto:[email protected]>> wrote:
>
> This is the first set of changes to allow building qemu-ga with
Microsoft Windows Clang.
> It includes some cleanups and fixes that also make the code more
portable.
> The main goal is to be able to build qemu-ga with the MSVC toolchain > because MinGW-w64 is not available for ARM64 Windows.
>
Hello,
Quoted 7 lines
MinGW-w64 is available for arm64 Windows, although it’s more
mature with Clang as a compiler instead of of MSVC.
I expect to use clang from the MSVC environment, not the MSVC compiler
Is the difference that this clang does not come with mingw preinstalled, and thus require using msvc headers/libraries instead?
In all cases, it's just better to use msys2 environment. What is your limitation with it?
Quoted 7 lines
Is it more of a packaging issue with distributions?
Thank you,
-Mohamed
Quoted 23 lines · Pierrick Bouvier
Quoted 7 lines · Kostiantyn Kostiuk
On Thu, Mar 26, 2026 at 6:35 PM Mohamed Mediouni <[email protected] <mailto:[email protected]>> wrote:
Quoted 8 lines
> On 26. Mar 2026, at 17:00, Kostiantyn Kostiuk
<[email protected] <mailto:[email protected]>> wrote:
>
> This is the first set of changes to allow building qemu-ga with
Microsoft Windows Clang.
> It includes some cleanups and fixes that also make the code more
portable.
> The main goal is to be able to build qemu-ga with the MSVCtoolchain
Quoted 6 lines
> because MinGW-w64 is not available for ARM64 Windows. >
Hello,MinGW-w64 is available for arm64 Windows, although it’s more
Quoted 9 lines
Quoted 5 lines
mature with Clang as a compiler instead of of MSVC.
I expect to use clang from the MSVC environment, not the MSVC compiler
Is the difference that this clang does not come with mingw preinstalled, and thus require using msvc headers/libraries instead?
Yes, the difference is that MSVC Clang comes with MSVC headers/libraries, not a Linux/MinGW one
Quoted 4 lines
In all cases, it's just better to use msys2 environment. What is your limitation with it?
This requires additional maintenance of the MSYS2 environment. Also, MSYS2 is a rolling release distribution, while we definitely need to know the version of dependencies and control them.
Quoted 10 lines
Quoted 8 lines
Is it more of a packaging issue with distributions?
Thank you,
-Mohamed
Quoted 39 lines · Kostiantyn Kostiuk
On Thu, Mar 26, 2026 at 6:48 PM Pierrick Bouvier <[email protected] <mailto:[email protected]>> wrote:
On 3/26/26 9:43 AM, Kostiantyn Kostiuk wrote:
>
>
>
> On Thu, Mar 26, 2026 at 6:35 PM Mohamed Mediouni
> <[email protected] <mailto:[email protected]>
<mailto:[email protected] <mailto:[email protected]>>> wrote:
>
>
> > On 26. Mar 2026, at 17:00, Kostiantyn Kostiuk > <[email protected] <mailto:[email protected]>
<mailto:[email protected] <mailto:[email protected]>>> wrote:
> >
> > This is the first set of changes to allow building qemu-ga
with
> Microsoft Windows Clang.
> > It includes some cleanups and fixes that also make the
code more
> portable.
> > The main goal is to be able to build qemu-ga with the MSVC
toolchain
> > because MinGW-w64 is not available for ARM64 Windows. > >
> Hello,
>
> MinGW-w64 is available for arm64 Windows, although it’s more >
> mature with Clang as a compiler instead of of MSVC. >
>
> I expect to use clang from the MSVC environment, not the MSVC
compiler
>
Quoted 7 lines
Is the difference that this clang does not come with mingw preinstalled,
and thus require using msvc headers/libraries instead?Yes, the difference is that MSVC Clang comes with MSVC headers/ libraries, not a Linux/MinGW one
I'm surprised you don't run into other issues than the one this series fixes, that's great!
Quoted 9 lines
In all cases, it's just better to use msys2 environment. What is your limitation with it?
This requires additional maintenance of the MSYS2 environment. Also, MSYS2 is a rolling release distribution, while we definitely need to know the version of dependencies and control them.
The maintenance is quite low in my experience, but I understand the concern with the rolling release aspect of it. By curiosity, for dependencies in MSVC environment, do you use a package manager (vcpkg, winget, other) or build them from source?
Quoted 9 lines
>
> Is it more of a packaging issue with distributions?
>
> Thank you,
> -Mohamed
>
>Quoted 63 lines · Pierrick Bouvier
Quoted 40 lines · Kostiantyn Kostiuk
On Thu, Mar 26, 2026 at 6:48 PM Pierrick Bouvier <[email protected] <mailto:[email protected]>> wrote:
On 3/26/26 9:43 AM, Kostiantyn Kostiuk wrote:
>
>
>
> On Thu, Mar 26, 2026 at 6:35 PM Mohamed Mediouni
> <[email protected] <mailto:[email protected]>
<mailto:[email protected] <mailto:[email protected]>>> wrote:
>
>
> > On 26. Mar 2026, at 17:00, Kostiantyn Kostiuk > <[email protected] <mailto:[email protected]>
<mailto:[email protected] <mailto:[email protected]>>> wrote:
> >
> > This is the first set of changes to allow building qemu-ga
with
> Microsoft Windows Clang.
> > It includes some cleanups and fixes that also make the
code more
> portable.
> > The main goal is to be able to build qemu-ga with the MSVC
toolchain
> > because MinGW-w64 is not available for ARM64 Windows. > >
> Hello,
>
> MinGW-w64 is available for arm64 Windows, although it’s more >
> mature with Clang as a compiler instead of of MSVC. >
>
> I expect to use clang from the MSVC environment, not the MSVC
compiler
>Quoted 8 lines
Is the difference that this clang does not come with mingw preinstalled,
and thus require using msvc headers/libraries instead?Yes, the difference is that MSVC Clang comes with MSVC headers/ libraries, not a Linux/MinGW one
I'm surprised you don't run into other issues than the one this series fixes, that's great!
Quoted 9 lines
In all cases, it's just better to use msys2 environment. What is your limitation with it?
This requires additional maintenance of the MSYS2 environment. Also, MSYS2 is a rolling release distribution, while we definitely need to know the version of dependencies and control them.
Quoted 5 lines
The maintenance is quite low in my experience, but I understand the concern with the rolling release aspect of it.
By curiosity, for dependencies in MSVC environment, do you use a package manager (vcpkg, winget, other) or build them from source?
As a complement, you can use msys2 and install manually the versions you want for dependencies, and mirror them for reproducibility if you're concerned they disappear. I would not worry too much about following the toolchain and build tools from the rolling release, and you would just have to do it for libraries QEMU use.
See for instance index of packages here:
https://repo.msys2.org/mingw/clangarm64/
Quoted 10 lines
Quoted 9 lines
> > Is it more of a packaging issue with distributions? > > Thank you, > -Mohamed > >
Quoted 71 lines · Pierrick Bouvier
Quoted 56 lines · Pierrick Bouvier
Quoted 40 lines · Kostiantyn Kostiuk
On Thu, Mar 26, 2026 at 6:48 PM Pierrick Bouvier <[email protected] <mailto:[email protected]>> wrote:
On 3/26/26 9:43 AM, Kostiantyn Kostiuk wrote:
>
>
>
> On Thu, Mar 26, 2026 at 6:35 PM Mohamed Mediouni
> <[email protected] <mailto:[email protected]>
<mailto:[email protected] <mailto:[email protected]>>> wrote:
>
>
> > On 26. Mar 2026, at 17:00, Kostiantyn Kostiuk
> <[email protected] <mailto:[email protected]>
<mailto:[email protected] <mailto:[email protected]>>> wrote:
> >
> > This is the first set of changes to allow building qemu-ga
with
> Microsoft Windows Clang.
> > It includes some cleanups and fixes that also make the
code more
> portable.
> > The main goal is to be able to build qemu-ga with the MSVC
toolchain
> > because MinGW-w64 is not available for ARM64 Windows.
> >
> Hello,
>
> MinGW-w64 is available for arm64 Windows, although it’s more
>
> mature with Clang as a compiler instead of of MSVC.
>
>
> I expect to use clang from the MSVC environment, not the MSVC
compiler
>Quoted 8 lines
Is the difference that this clang does not come with mingw preinstalled,
and thus require using msvc headers/libraries instead?Yes, the difference is that MSVC Clang comes with MSVC headers/ libraries, not a Linux/MinGW one
I'm surprised you don't run into other issues than the one this series fixes, that's great!
Quoted 5 lines
In all cases, it's just better to use msys2 environment. What is your limitation with it?
Quoted 9 lines
Quoted 4 lines
This requires additional maintenance of the MSYS2 environment. Also, MSYS2 is a rolling release distribution, while we definitely need to know the version of dependencies and control them.
The maintenance is quite low in my experience, but I understand the concern with the rolling release aspect of it.
By curiosity, for dependencies in MSVC environment, do you use a package manager (vcpkg, winget, other) or build them from source?
Quoted 5 lines
As a complement, you can use msys2 and install manually the versions you want for dependencies, and mirror them for reproducibility if you're concerned they disappear. I would not worry too much about following the toolchain and build tools from the rolling release, and you would just have to do it for libraries QEMU use.
See for instance index of packages here:
https://repo.msys2.org/mingw/clangarm64/
Hi,
There’s also this: https://github.com/mstorsjo/llvm-mingw for a full build from source.
My own setup is LLVM + MinGW built from source and then a hacked up a bit version of MXE to build glib, gtk and others, but those aren’t needed for the guest agent
Quoted 8 lines · Mohamed Mediouni
Quoted 8 lines · Kostiantyn Kostiuk
This is the first set of changes to allow building qemu-ga with Microsoft Windows Clang. It includes some cleanups and fixes that also make the code more portable. The main goal is to be able to build qemu-ga with the MSVC toolchain because MinGW-w64 is not available for ARM64 Windows.
Quoted 5 lines
Hello,
MinGW-w64 is available for arm64 Windows, although it’s more mature with Clang as a compiler instead of of MSVC.
As a complement to Mohamed message, this documentation will help you to build QEMU on windows platforms (including arm64):
https://www.qemu.org/docs/master/devel/build-environment.html#windows
Just make sure to do this from the console you get with:
c:/msys64/msys2_shell.cmd -defterm -here -no-start -clangarm64
Quoted 6 lines
Is it more of a packaging issue with distributions?
Thank you,
-Mohamed
Il gio 26 mar 2026, 17:34 Mohamed Mediouni <[email protected]> ha scritto:
Quoted 11 lines
Quoted 2 lines
On 26. Mar 2026, at 17:00, Kostiantyn Kostiuk <[email protected]>
Quoted 2 lines · wrote:
This is the first set of changes to allow building qemu-ga with
Microsoft Windows Clang.
Quoted 1 line
It includes some cleanups and fixes that also make the code more
portable.
Quoted 3 lines
The main goal is to be able to build qemu-ga with the MSVC toolchain because MinGW-w64 is not available for ARM64 Windows.
Quoted 7 lines
Hello,
MinGW-w64 is available for arm64 Windows, although it’s more mature with Clang as a compiler instead of of MSVC.
Is it more of a packaging issue with distributions?
Yeah, I think this is about *Fedora* mingw specifically.
The packaging/version pinning aspect probably can be handled with a Meson subproject for glib (and other dependencies if any).
Paolo
Quoted 4 lines
Thank you,
-Mohamed