* [PATCH 0/2] Fix Windows build issues with newer MinGW
@ 2025-12-15 16:45 phind.uet
2025-12-15 16:45 ` [PATCH 1/2] qga/vss-win32: Fix ConvertStringToBSTR redefinition " phind.uet
2025-12-15 16:45 ` [PATCH 2/2] util: Move qemu_ftruncate64 from block/file-win32.c to oslib-win32.c phind.uet
0 siblings, 2 replies; 9+ messages in thread
From: phind.uet @ 2025-12-15 16:45 UTC (permalink / raw)
To: Paolo Bonzini, marcandre.lureau, berrange, philmd,
Kostiantyn Kostiuk, Michael Roth, Kevin Wolf, Hanna Reitz,
Stefan Weil
Cc: Nguyen Dinh Phi, qemu-block, qemu-devel
From: Nguyen Dinh Phi <phind.uet@gmail.com>
This series fixes build issues when compiling QEMU on Windows with
newer MinGW-w64 toolchains.
Patch 1 addresses a redefinition error for ConvertStringToBSTR(),
which is now provided by newer MinGW versions in <comutil.h>.
Patch 2 relocates qemu_ftruncate64() to a more appropriate location.
Nguyen Dinh Phi (2):
qga/vss-win32: Fix ConvertStringToBSTR redefinition with newer MinGW
util: Move qemu_ftruncate64 from block/file-win32.c to oslib-win32.c
block/file-win32.c | 32 --------------------------------
meson.build | 12 ++++++++++++
qga/vss-win32/install.cpp | 2 ++
util/oslib-win32.c | 34 ++++++++++++++++++++++++++++++++++
4 files changed, 48 insertions(+), 32 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] qga/vss-win32: Fix ConvertStringToBSTR redefinition with newer MinGW
2025-12-15 16:45 [PATCH 0/2] Fix Windows build issues with newer MinGW phind.uet
@ 2025-12-15 16:45 ` phind.uet
2025-12-16 6:26 ` Marc-André Lureau
2025-12-16 23:00 ` Pierrick Bouvier
2025-12-15 16:45 ` [PATCH 2/2] util: Move qemu_ftruncate64 from block/file-win32.c to oslib-win32.c phind.uet
1 sibling, 2 replies; 9+ messages in thread
From: phind.uet @ 2025-12-15 16:45 UTC (permalink / raw)
To: Paolo Bonzini, Marc-André Lureau, Daniel P. Berrangé,
Philippe Mathieu-Daudé, Kostiantyn Kostiuk, Michael Roth
Cc: Nguyen Dinh Phi, qemu-devel
From: Nguyen Dinh Phi <phind.uet@gmail.com>
Newer versions of MinGW-w64 provide ConvertStringToBSTR() in the
_com_util namespace via <comutil.h>. This causes a redefinition
error when building qemu-ga on Windows with these toolchains.
Add a meson check to detect whether ConvertStringToBSTR is already
available, and conditionally compile our fallback implementation
only when the system does not provide one.
Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
---
meson.build | 12 ++++++++++++
qga/vss-win32/install.cpp | 2 ++
2 files changed, 14 insertions(+)
diff --git a/meson.build b/meson.build
index c5710a6a47..60a980e610 100644
--- a/meson.build
+++ b/meson.build
@@ -3299,6 +3299,18 @@ endif
# Detect host pointer size for the target configuration loop.
host_long_bits = cc.sizeof('void *') * 8
+# Detect if ConvertStringToBSTR has been defined in _com_util namespace
+if host_os == 'windows'
+ has_convert_string_to_bstr = cxx.compiles('''
+ #include <comutil.h>
+ int main() {
+ BSTR b = _com_util::ConvertStringToBSTR("test");
+ return b ? 0 : 1;
+ }
+ ''')
+ config_host_data.set('CONFIG_CONVERT_STRING_TO_BSTR', has_convert_string_to_bstr)
+endif
+
########################
# Target configuration #
########################
diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp
index 7b25d9098b..5b7a8e9bc5 100644
--- a/qga/vss-win32/install.cpp
+++ b/qga/vss-win32/install.cpp
@@ -549,6 +549,7 @@ STDAPI DllUnregisterServer(void)
/* Support function to convert ASCII string into BSTR (used in _bstr_t) */
+#ifndef CONFIG_CONVERT_STRING_TO_BSTR
namespace _com_util
{
BSTR WINAPI ConvertStringToBSTR(const char *ascii) {
@@ -566,6 +567,7 @@ namespace _com_util
return bstr;
}
}
+#endif
/* Stop QGA VSS provider service using Winsvc API */
STDAPI StopService(void)
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2] util: Move qemu_ftruncate64 from block/file-win32.c to oslib-win32.c
2025-12-15 16:45 [PATCH 0/2] Fix Windows build issues with newer MinGW phind.uet
2025-12-15 16:45 ` [PATCH 1/2] qga/vss-win32: Fix ConvertStringToBSTR redefinition " phind.uet
@ 2025-12-15 16:45 ` phind.uet
2025-12-15 17:33 ` Philippe Mathieu-Daudé
2025-12-16 23:00 ` Pierrick Bouvier
1 sibling, 2 replies; 9+ messages in thread
From: phind.uet @ 2025-12-15 16:45 UTC (permalink / raw)
To: Kevin Wolf, Hanna Reitz, Stefan Weil
Cc: Nguyen Dinh Phi, qemu-block, qemu-devel
From: Nguyen Dinh Phi <phind.uet@gmail.com>
qemu_ftruncate64() is utility function that may be used outside of the block
layer. Move it to util/oslib-win32.c where other Windows-specific utility
functions reside.
Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
---
block/file-win32.c | 32 --------------------------------
util/oslib-win32.c | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+), 32 deletions(-)
diff --git a/block/file-win32.c b/block/file-win32.c
index af9aea631c..8a44853389 100644
--- a/block/file-win32.c
+++ b/block/file-win32.c
@@ -170,38 +170,6 @@ static BlockAIOCB *paio_submit(BlockDriverState *bs, HANDLE hfile,
return thread_pool_submit_aio(aio_worker, acb, cb, opaque);
}
-int qemu_ftruncate64(int fd, int64_t length)
-{
- LARGE_INTEGER li;
- DWORD dw;
- LONG high;
- HANDLE h;
- BOOL res;
-
- if ((GetVersion() & 0x80000000UL) && (length >> 32) != 0)
- return -1;
-
- h = (HANDLE)_get_osfhandle(fd);
-
- /* get current position, ftruncate do not change position */
- li.HighPart = 0;
- li.LowPart = SetFilePointer (h, 0, &li.HighPart, FILE_CURRENT);
- if (li.LowPart == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) {
- return -1;
- }
-
- high = length >> 32;
- dw = SetFilePointer(h, (DWORD) length, &high, FILE_BEGIN);
- if (dw == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) {
- return -1;
- }
- res = SetEndOfFile(h);
-
- /* back to old position */
- SetFilePointer(h, li.LowPart, &li.HighPart, FILE_BEGIN);
- return res ? 0 : -1;
-}
-
static int set_sparse(int fd)
{
DWORD returned;
diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index 839b8a4170..766c602172 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -899,3 +899,37 @@ int qemu_shm_alloc(size_t size, Error **errp)
error_setg(errp, "Shared memory is not supported.");
return -1;
}
+
+int qemu_ftruncate64(int fd, int64_t length)
+{
+ LARGE_INTEGER li;
+ DWORD dw;
+ LONG high;
+ HANDLE h;
+ BOOL res;
+
+ if ((GetVersion()&0x80000000UL) && (length >> 32) != 0) {
+ return -1;
+ }
+
+ h = (HANDLE)_get_osfhandle(fd);
+
+ /* get current position, ftruncate do not change position */
+ li.HighPart = 0;
+ li.LowPart = SetFilePointer (h, 0, &li.HighPart, FILE_CURRENT);
+ if (li.LowPart == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) {
+ return -1;
+ }
+
+ high = length >> 32;
+ dw = SetFilePointer(h, (DWORD) length, &high, FILE_BEGIN);
+ if (dw == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) {
+ return -1;
+ }
+ res = SetEndOfFile(h);
+
+ /* back to old position */
+ SetFilePointer(h, li.LowPart, &li.HighPart, FILE_BEGIN);
+ return res ? 0 : -1;
+}
+
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] util: Move qemu_ftruncate64 from block/file-win32.c to oslib-win32.c
2025-12-15 16:45 ` [PATCH 2/2] util: Move qemu_ftruncate64 from block/file-win32.c to oslib-win32.c phind.uet
@ 2025-12-15 17:33 ` Philippe Mathieu-Daudé
2025-12-16 23:00 ` Pierrick Bouvier
1 sibling, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-12-15 17:33 UTC (permalink / raw)
To: phind.uet, Kevin Wolf, Hanna Reitz, Stefan Weil; +Cc: qemu-block, qemu-devel
On 15/12/25 17:45, phind.uet@gmail.com wrote:
> From: Nguyen Dinh Phi <phind.uet@gmail.com>
>
> qemu_ftruncate64() is utility function that may be used outside of the block
> layer. Move it to util/oslib-win32.c where other Windows-specific utility
> functions reside.
>
> Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
> ---
> block/file-win32.c | 32 --------------------------------
> util/oslib-win32.c | 34 ++++++++++++++++++++++++++++++++++
> 2 files changed, 34 insertions(+), 32 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] qga/vss-win32: Fix ConvertStringToBSTR redefinition with newer MinGW
2025-12-15 16:45 ` [PATCH 1/2] qga/vss-win32: Fix ConvertStringToBSTR redefinition " phind.uet
@ 2025-12-16 6:26 ` Marc-André Lureau
2025-12-16 9:53 ` Kostiantyn Kostiuk
2025-12-16 23:00 ` Pierrick Bouvier
1 sibling, 1 reply; 9+ messages in thread
From: Marc-André Lureau @ 2025-12-16 6:26 UTC (permalink / raw)
To: phind.uet
Cc: Paolo Bonzini, Daniel P. Berrangé,
Philippe Mathieu-Daudé, Kostiantyn Kostiuk, Michael Roth,
qemu-devel
[-- Attachment #1: Type: text/plain, Size: 2326 bytes --]
Hi
On Mon, Dec 15, 2025 at 8:57 PM <phind.uet@gmail.com> wrote:
> From: Nguyen Dinh Phi <phind.uet@gmail.com>
>
> Newer versions of MinGW-w64 provide ConvertStringToBSTR() in the
> _com_util namespace via <comutil.h>. This causes a redefinition
> error when building qemu-ga on Windows with these toolchains.
>
> Add a meson check to detect whether ConvertStringToBSTR is already
> available, and conditionally compile our fallback implementation
> only when the system does not provide one.
>
> Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
> ---
> meson.build | 12 ++++++++++++
> qga/vss-win32/install.cpp | 2 ++
> 2 files changed, 14 insertions(+)
>
> diff --git a/meson.build b/meson.build
> index c5710a6a47..60a980e610 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -3299,6 +3299,18 @@ endif
> # Detect host pointer size for the target configuration loop.
> host_long_bits = cc.sizeof('void *') * 8
>
> +# Detect if ConvertStringToBSTR has been defined in _com_util namespace
> +if host_os == 'windows'
> + has_convert_string_to_bstr = cxx.compiles('''
> + #include <comutil.h>
> + int main() {
> + BSTR b = _com_util::ConvertStringToBSTR("test");
> + return b ? 0 : 1;
> + }
> + ''')
> + config_host_data.set('CONFIG_CONVERT_STRING_TO_BSTR',
> has_convert_string_to_bstr)
> +endif
> +
> ########################
> # Target configuration #
> ########################
> diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp
> index 7b25d9098b..5b7a8e9bc5 100644
> --- a/qga/vss-win32/install.cpp
> +++ b/qga/vss-win32/install.cpp
> @@ -549,6 +549,7 @@ STDAPI DllUnregisterServer(void)
>
>
> /* Support function to convert ASCII string into BSTR (used in _bstr_t) */
> +#ifndef CONFIG_CONVERT_STRING_TO_BSTR
>
I wonder if it could check __MINGW64_VERSION_MAJOR >= 14 instead of adding
a configure-time check.
lgtm anyway
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
namespace _com_util
> {
> BSTR WINAPI ConvertStringToBSTR(const char *ascii) {
> @@ -566,6 +567,7 @@ namespace _com_util
> return bstr;
> }
> }
> +#endif
>
> /* Stop QGA VSS provider service using Winsvc API */
> STDAPI StopService(void)
> --
> 2.43.0
>
>
[-- Attachment #2: Type: text/html, Size: 3276 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] qga/vss-win32: Fix ConvertStringToBSTR redefinition with newer MinGW
2025-12-16 6:26 ` Marc-André Lureau
@ 2025-12-16 9:53 ` Kostiantyn Kostiuk
2025-12-17 18:13 ` Pierrick Bouvier
0 siblings, 1 reply; 9+ messages in thread
From: Kostiantyn Kostiuk @ 2025-12-16 9:53 UTC (permalink / raw)
To: Marc-André Lureau, Peter Maydell
Cc: phind.uet, Paolo Bonzini, Daniel P. Berrangé,
Philippe Mathieu-Daudé, Michael Roth, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 2857 bytes --]
Hi
On Tue, Dec 16, 2025 at 8:26 AM Marc-André Lureau <
marcandre.lureau@redhat.com> wrote:
> Hi
>
> On Mon, Dec 15, 2025 at 8:57 PM <phind.uet@gmail.com> wrote:
>
>> From: Nguyen Dinh Phi <phind.uet@gmail.com>
>>
>> Newer versions of MinGW-w64 provide ConvertStringToBSTR() in the
>> _com_util namespace via <comutil.h>. This causes a redefinition
>> error when building qemu-ga on Windows with these toolchains.
>>
>> Add a meson check to detect whether ConvertStringToBSTR is already
>> available, and conditionally compile our fallback implementation
>> only when the system does not provide one.
>>
>> Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
>> ---
>> meson.build | 12 ++++++++++++
>> qga/vss-win32/install.cpp | 2 ++
>> 2 files changed, 14 insertions(+)
>>
>> diff --git a/meson.build b/meson.build
>> index c5710a6a47..60a980e610 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -3299,6 +3299,18 @@ endif
>> # Detect host pointer size for the target configuration loop.
>> host_long_bits = cc.sizeof('void *') * 8
>>
>> +# Detect if ConvertStringToBSTR has been defined in _com_util namespace
>> +if host_os == 'windows'
>> + has_convert_string_to_bstr = cxx.compiles('''
>> + #include <comutil.h>
>> + int main() {
>> + BSTR b = _com_util::ConvertStringToBSTR("test");
>> + return b ? 0 : 1;
>> + }
>> + ''')
>> + config_host_data.set('CONFIG_CONVERT_STRING_TO_BSTR',
>> has_convert_string_to_bstr)
>> +endif
>> +
>> ########################
>> # Target configuration #
>> ########################
>> diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp
>> index 7b25d9098b..5b7a8e9bc5 100644
>> --- a/qga/vss-win32/install.cpp
>> +++ b/qga/vss-win32/install.cpp
>> @@ -549,6 +549,7 @@ STDAPI DllUnregisterServer(void)
>>
>>
>> /* Support function to convert ASCII string into BSTR (used in _bstr_t)
>> */
>> +#ifndef CONFIG_CONVERT_STRING_TO_BSTR
>>
>
> I wonder if it could check __MINGW64_VERSION_MAJOR >= 14 instead of adding
> a configure-time check.
>
@Peter Maydell <peter.maydell@linaro.org> preferred to avoid specific
version-number checks.
See: https://gitlab.com/qemu-project/qemu/-/issues/3217#note_2935451782
I also preferred the idea of checking the real function present instead of
the version of the component.
Reviewed-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
>
> lgtm anyway
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> namespace _com_util
>> {
>> BSTR WINAPI ConvertStringToBSTR(const char *ascii) {
>> @@ -566,6 +567,7 @@ namespace _com_util
>> return bstr;
>> }
>> }
>> +#endif
>>
>> /* Stop QGA VSS provider service using Winsvc API */
>> STDAPI StopService(void)
>> --
>> 2.43.0
>>
>>
[-- Attachment #2: Type: text/html, Size: 4519 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] qga/vss-win32: Fix ConvertStringToBSTR redefinition with newer MinGW
2025-12-15 16:45 ` [PATCH 1/2] qga/vss-win32: Fix ConvertStringToBSTR redefinition " phind.uet
2025-12-16 6:26 ` Marc-André Lureau
@ 2025-12-16 23:00 ` Pierrick Bouvier
1 sibling, 0 replies; 9+ messages in thread
From: Pierrick Bouvier @ 2025-12-16 23:00 UTC (permalink / raw)
To: phind.uet, Paolo Bonzini, Marc-André Lureau,
Daniel P. Berrangé, Philippe Mathieu-Daudé,
Kostiantyn Kostiuk, Michael Roth
Cc: qemu-devel
On 12/15/25 8:45 AM, phind.uet@gmail.com wrote:
> From: Nguyen Dinh Phi <phind.uet@gmail.com>
>
> Newer versions of MinGW-w64 provide ConvertStringToBSTR() in the
> _com_util namespace via <comutil.h>. This causes a redefinition
> error when building qemu-ga on Windows with these toolchains.
>
> Add a meson check to detect whether ConvertStringToBSTR is already
> available, and conditionally compile our fallback implementation
> only when the system does not provide one.
>
> Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
> ---
> meson.build | 12 ++++++++++++
> qga/vss-win32/install.cpp | 2 ++
> 2 files changed, 14 insertions(+)
Thanks for the fix, I was looking at this error.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] util: Move qemu_ftruncate64 from block/file-win32.c to oslib-win32.c
2025-12-15 16:45 ` [PATCH 2/2] util: Move qemu_ftruncate64 from block/file-win32.c to oslib-win32.c phind.uet
2025-12-15 17:33 ` Philippe Mathieu-Daudé
@ 2025-12-16 23:00 ` Pierrick Bouvier
1 sibling, 0 replies; 9+ messages in thread
From: Pierrick Bouvier @ 2025-12-16 23:00 UTC (permalink / raw)
To: phind.uet, Kevin Wolf, Hanna Reitz, Stefan Weil; +Cc: qemu-block, qemu-devel
On 12/15/25 8:45 AM, phind.uet@gmail.com wrote:
> From: Nguyen Dinh Phi <phind.uet@gmail.com>
>
> qemu_ftruncate64() is utility function that may be used outside of the block
> layer. Move it to util/oslib-win32.c where other Windows-specific utility
> functions reside.
>
> Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
> ---
> block/file-win32.c | 32 --------------------------------
> util/oslib-win32.c | 34 ++++++++++++++++++++++++++++++++++
> 2 files changed, 34 insertions(+), 32 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] qga/vss-win32: Fix ConvertStringToBSTR redefinition with newer MinGW
2025-12-16 9:53 ` Kostiantyn Kostiuk
@ 2025-12-17 18:13 ` Pierrick Bouvier
0 siblings, 0 replies; 9+ messages in thread
From: Pierrick Bouvier @ 2025-12-17 18:13 UTC (permalink / raw)
To: Kostiantyn Kostiuk, Marc-André Lureau, Peter Maydell
Cc: phind.uet, Paolo Bonzini, Daniel P. Berrangé,
Philippe Mathieu-Daudé, Michael Roth, qemu-devel
On 12/16/25 1:53 AM, Kostiantyn Kostiuk wrote:
> Hi
>
> On Tue, Dec 16, 2025 at 8:26 AM Marc-André Lureau
> <marcandre.lureau@redhat.com <mailto:marcandre.lureau@redhat.com>> wrote:
>
> Hi
>
> On Mon, Dec 15, 2025 at 8:57 PM <phind.uet@gmail.com
> <mailto:phind.uet@gmail.com>> wrote:
>
> From: Nguyen Dinh Phi <phind.uet@gmail.com
> <mailto:phind.uet@gmail.com>>
>
> Newer versions of MinGW-w64 provide ConvertStringToBSTR() in the
> _com_util namespace via <comutil.h>. This causes a redefinition
> error when building qemu-ga on Windows with these toolchains.
>
> Add a meson check to detect whether ConvertStringToBSTR is already
> available, and conditionally compile our fallback implementation
> only when the system does not provide one.
>
> Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com
> <mailto:phind.uet@gmail.com>>
> ---
> meson.build | 12 ++++++++++++
> qga/vss-win32/install.cpp | 2 ++
> 2 files changed, 14 insertions(+)
>
> diff --git a/meson.build b/meson.build
> index c5710a6a47..60a980e610 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -3299,6 +3299,18 @@ endif
> # Detect host pointer size for the target configuration loop.
> host_long_bits = cc.sizeof('void *') * 8
>
> +# Detect if ConvertStringToBSTR has been defined in _com_util
> namespace
> +if host_os == 'windows'
> + has_convert_string_to_bstr = cxx.compiles('''
> + #include <comutil.h>
> + int main() {
> + BSTR b = _com_util::ConvertStringToBSTR("test");
> + return b ? 0 : 1;
> + }
> + ''')
> + config_host_data.set('CONFIG_CONVERT_STRING_TO_BSTR',
> has_convert_string_to_bstr)
> +endif
> +
> ########################
> # Target configuration #
> ########################
> diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp
> index 7b25d9098b..5b7a8e9bc5 100644
> --- a/qga/vss-win32/install.cpp
> +++ b/qga/vss-win32/install.cpp
> @@ -549,6 +549,7 @@ STDAPI DllUnregisterServer(void)
>
>
> /* Support function to convert ASCII string into BSTR (used in
> _bstr_t) */
> +#ifndef CONFIG_CONVERT_STRING_TO_BSTR
>
>
> I wonder if it could check __MINGW64_VERSION_MAJOR >= 14 instead of
> adding a configure-time check.
>
>
> @Peter Maydell <mailto:peter.maydell@linaro.org> preferred to avoid
> specific version-number checks.
> See: https://gitlab.com/qemu-project/qemu/-/issues/3217#note_2935451782
> <https://gitlab.com/qemu-project/qemu/-/issues/3217#note_2935451782>
>
> I also preferred the idea of checking the real function present instead
> of the version of the component.
>
> Reviewed-by: Kostiantyn Kostiuk <kkostiuk@redhat.com
> <mailto:kkostiuk@redhat.com>>
>
>
> lgtm anyway
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com
> <mailto:marcandre.lureau@redhat.com>>
>
> namespace _com_util
> {
> BSTR WINAPI ConvertStringToBSTR(const char *ascii) {
> @@ -566,6 +567,7 @@ namespace _com_util
> return bstr;
> }
> }
> +#endif
>
> /* Stop QGA VSS provider service using Winsvc API */
> STDAPI StopService(void)
> --
> 2.43.0
>
When cross-compiling using fedora-win64-cross, it can find the function
in header but does not link it.
$ podman run --pull newer --init --rm -it -v $(pwd):$(pwd) -w $(pwd) \
docker.io/pbolinaro/qemu-ci:fedora-win64-cross \
bash -cx './configure $QEMU_CONFIGURE_OPTS && ninja -C build install'
...
[4434/4696] Linking target qga/vss-win32/qga-vss.dll
FAILED: qga/vss-win32/qga-vss.dll
x86_64-w64-mingw32-g++ -m64 -o qga/vss-win32/qga-vss.dll
qga/vss-win32/qga-vss.dll.p/requester.cpp.obj
qga/vss-win32/qga-vss.dll.p/provider.cpp.obj
qga/vss-win32/qga-vss.dll.p/install.cpp.obj
qga/vss-win32/qga-vss.dll.p/vss-debug.cpp.obj
-Wl,--allow-shlib-undefined -shared ../qga/vss-win32/qga-vss.def
-Wl,--start-group -Wl,--out-implib=qga/vss-win32/qga-vss.dll.a
-fstack-protector-strong -Wl,--no-seh -Wl,--nxcompat -Wl,--dynamicbase
-Wl,--high-entropy-va -fstack-protector-all -fstack-protector-strong
-Wl,--add-stdcall-alias -Wl,--enable-stdcall-fixup -lws2_32 -lole32
-loleaut32 -lshlwapi -luuid -lkernel32 -luser32 -lgdi32 -lwinspool
-lshell32 -lcomdlg32 -ladvapi32 -Wl,--end-group
/usr/lib/gcc/x86_64-w64-mingw32/14.2.1/../../../../x86_64-w64-mingw32/bin/ld:
qga/vss-win32/qga-vss.dll.p/install.cpp.obj: in function
`_bstr_t::Data_t::Data_t(char const*)':
/usr/x86_64-w64-mingw32/sys-root/mingw/include/comutil.h:279:(.text+0x1dc8):
undefined reference to `_com_util::ConvertStringToBSTR(char const*)'
...
Looking into mingw files, the symbol is not there.
$ nm /usr/x86_64-w64-mingw32/sys-root/mingw/lib/lib*.a |
grep -i ConvertStringToBSTR
It's present in header file though:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/comutil.h
Not sure if something is missing in mingw, or if it's missing an
attribute to say it should be available at runtime only, but in all
cases, a simple fix to the patch is:
diff --git a/meson.build b/meson.build
index ab19317f5af..113296544c4 100644
--- a/meson.build
+++ b/meson.build
@@ -3261,7 +3261,7 @@ host_long_bits = cc.sizeof('void *') * 8
# Detect if ConvertStringToBSTR has been defined in _com_util namespace
if host_os == 'windows'
- has_convert_string_to_bstr = cxx.compiles('''
+ has_convert_string_to_bstr = cxx.links('''
#include <comutil.h>
int main() {
BSTR b = _com_util::ConvertStringToBSTR("test");
I would recommend to use cxx.links instead of cxx.compiles for now.
Regards,
Pierrick
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-12-17 18:13 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-15 16:45 [PATCH 0/2] Fix Windows build issues with newer MinGW phind.uet
2025-12-15 16:45 ` [PATCH 1/2] qga/vss-win32: Fix ConvertStringToBSTR redefinition " phind.uet
2025-12-16 6:26 ` Marc-André Lureau
2025-12-16 9:53 ` Kostiantyn Kostiuk
2025-12-17 18:13 ` Pierrick Bouvier
2025-12-16 23:00 ` Pierrick Bouvier
2025-12-15 16:45 ` [PATCH 2/2] util: Move qemu_ftruncate64 from block/file-win32.c to oslib-win32.c phind.uet
2025-12-15 17:33 ` Philippe Mathieu-Daudé
2025-12-16 23:00 ` Pierrick Bouvier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).