10.2.0rc1: Building on Windows in Msys2/UCRT64 fails
Host environment
- Operating system: Windows 10 22H2, Msys2/UCRT64
- OS/kernel version: MINGW64_NT-10.0-19045 DESKTOP-6MOKBL6 3.6.5-0eeda3e1.x86_64 2025-10-10 14:51 UTC x86_64 Msys
- Architecture: x86_64
- QEMU flavor: n/a
- QEMU version: qemu-10.2.0-rc1.tar.xz
- QEMU command line: n/a
Emulated/Virtualized environment
- Operating system: n/a
- OS/kernel version: n/a
- Architecture: n/a
Description of problem
In an up-to-date Msys2/UCRT64 environment with all necessary dependencies (current qemu is installed from repository), building qemu from source tarball in Msys2/UCRT64 fails with
FAILED: [code=1] qga/vss-win32/qga-vss.dll.p/install.cpp.obj
"c++" "-m64" "-Iqga/vss-win32/qga-vss.dll.p" "-Iqga/vss-win32" "-I../qga/vss-win32" "-I." "-Iqapi" "-Itrace" "-Iui" "-Iui/shader" "-ID:/msys64/ucrt64/include/glib-2.0" "-ID:/msys64/ucrt64/lib/glib-2.0/include" "-fdiagnostics-color=auto" "-D_GLIBCXX_ASSERTIONS=1" "-Wall" "-Winvalid-pch" "-std=gnu++11" "-O2" "-g" "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-fstack-protector-strong" "-Wempty-body" "-Wendif-labels" "-Wexpansion-to-defined" "-Wformat-security" "-Wformat-y2k" "-Wignored-qualifiers" "-Wimplicit-fallthrough=2" "-Winit-self" "-Wmissing-format-attribute" "-Wredundant-decls" "-Wshadow=local" "-Wtype-limits" "-Wundef" "-Wvla" "-Wwrite-strings" "-Wno-missing-include-dirs" "-Wno-psabi" "-Wno-shift-negative-value" "-iquote" "." "-iquote" "D:/msys64/home/Normalo/test/qemu-10.2.0-rc1" "-iquote" "D:/msys64/home/Normalo/test/qemu-10.2.0-rc1/include" "-iquote" "D:/msys64/home/Normalo/test/qemu-10.2.0-rc1/host/include/x86_64" "-iquote" "D:/msys64/home/Normalo/test/qemu-10.2.0-rc1/host/include/generic" "-iquote" "D:/msys64/home/Normalo/test/qemu-10.2.0-rc1/tcg/i386" "-mcx16" "-msse2" "-D_GNU_SOURCE" "-D_FILE_OFFSET_BITS=64" "-D_LARGEFILE_SOURCE" "-fno-strict-aliasing" "-fno-common" "-fwrapv" "-fno-pie" "-no-pie" "-ftrivial-auto-var-init=zero" "-fzero-call-used-regs=used-gpr" "-Wno-unknown-pragmas" "-Wno-delete-non-virtual-dtor" "-Wno-non-virtual-dtor" -MD -MQ qga/vss-win32/qga-vss.dll.p/install.cpp.obj -MF "qga/vss-win32/qga-vss.dll.p/install.cpp.obj.d" -o qga/vss-win32/qga-vss.dll.p/install.cpp.obj "-c" ../qga/vss-win32/install.cpp
../qga/vss-win32/install.cpp:554:17: error: redefinition of 'OLECHAR* _com_util::ConvertStringToBSTR(const char*)'
554 | BSTR WINAPI ConvertStringToBSTR(const char *ascii) {
| ^~~~~~~~~~~~~~~~~~~
In file included from D:/msys64/ucrt64/include/comdef.h:19,
from ../qga/vss-win32/install.cpp:24:
D:/msys64/ucrt64/include/comutil.h:55:22: note: 'OLECHAR* _com_util::ConvertStringToBSTR(const char*)' previously defined here
55 | inline BSTR WINAPI ConvertStringToBSTR(const char *pSrc){
| ^~~~~~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.
Steps to reproduce
- pacman -S mingw-w64-ucrt-x86_64-qemu
- cd
- wget https://download.qemu.org/qemu-10.2.0-rc1.tar.xz
- tar -xf qemu-10.2.0-rc1.tar.xz
- cd qemu-10.2.0-rc1
- ./configure --target-list=x86_64-softmmu
- make
Additional information
Build also fails in MSYS2-CI: see https://github.com/msys2/MINGW-packages/pull/26465 Find attached the log of the above build (10.2.0rc1.build.log) and the MSYS2-CI build logs (logs_50347707144.zip)
After removing the inline function ConvertStringToBSTR from qga/vss-win32/install.cpp the build succeeds. In MSYS2-CI all packages were built. The packaged guest agent is working as expected.
Edited by Helge Konetzka