qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] guest agent: Fixes for windows guest agent building on msys2


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH] guest agent: Fixes for windows guest agent building on msys2/mingw
Date: Tue, 15 Sep 2020 18:41:17 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0

On 9/15/20 6:33 PM, Yonggang Luo wrote:
> error message:
> "cc" "-Iqga/qemu-ga.exe.p" "-Iqga" "-I../qga" "-I." "-Iqapi" "-Itrace" "-Iui" 
> "-Iui/shader" "-IC:/CI-Tools/msys64/mingw64/include" 
> "-IC:/CI-Tools/msys64/mingw64/include/glib-2.0" 
> "-IC:/CI-Tools/msys64/mingw64/lib/glib-2.0/include" 
> "-fdiagnostics-color=auto" "-pipe" "-Wall" "-Winvalid-pch" "-Werror" 
> "-std=gnu99" "-g" "-m64" "-mcx16" "-D_GNU_SOURCE" "-D_FILE_OFFSET_BITS=64" 
> "-D_LARGEFILE_SOURCE" "-Wstrict-prototypes" "-Wredundant-decls" "-Wundef" 
> "-Wwrite-strings" "-Wmissing-prototypes" "-fno-strict-aliasing" "-fno-common" 
> "-fwrapv" "-Wold-style-declaration" "-Wold-style-definition" "-Wtype-limits" 
> "-Wformat-security" "-Wformat-y2k" "-Winit-self" "-Wignored-qualifiers" 
> "-Wempty-body" "-Wnested-externs" "-Wendif-labels" "-Wexpansion-to-defined" 
> "-Wno-missing-include-dirs" "-Wno-shift-negative-value" "-Wno-psabi" 
> "-fstack-protector-strong" "-iquote" "/c/work/xemu/qemu/tcg/i386" "-iquote" 
> "." "-iquote" "/c/work/xemu/qemu" "-iquote" "/c/work/xemu/qemu/accel/tcg" 
> "-iquote" "/c/work/xemu/qemu/include" "-iquote" 
> "/c/work/xemu/qemu/disas/libvixl" "-pthread" "-mms-bitfields" -MD -MQ 
> qga/qemu-ga.exe.p/commands-win32.c.obj -MF 
> "qga/qemu-ga.exe.p/commands-win32.c.obj.d" -o 
> qga/qemu-ga.exe.p/commands-win32.c.obj "-c" ../qga/commands-win32.c -MP
> ../qga/commands-win32.c:62:24: error: redundant redeclaration of 
> 'CM_Get_DevNode_PropertyW' [-Werror=redundant-decls]
>    62 | CMAPI CONFIGRET WINAPI CM_Get_DevNode_PropertyW(
>       |                        ^~~~~~~~~~~~~~~~~~~~~~~~
> In file included from ../qga/commands-win32.c:26:
> C:/CI-Tools/msys64/mingw64/x86_64-w64-mingw32/include/cfgmgr32.h:840:26: 
> note: previous declaration of 'CM_Get_DevNode_PropertyW' was here
>   840 |   CMAPI CONFIGRET WINAPI CM_Get_DevNode_PropertyW(DEVINST dnDevInst, 
> const DEVPROPKEY *PropertyKey, DEVPROPTYPE *PropertyType, PBYTE 
> PropertyBuffer, PULONG PropertyBufferSize, ULONG ulFlags);
>       |                          ^~~~~~~~~~~~~~~~~~~~~~~~
> cc1.exe: all warnings being treated as errors
> make: [Makefile.ninja:5143:qga/qemu-ga.exe.p/commands-win32.c.obj] 错误 1 (已忽略)
> 
> This error comes from qemu configure didn't add predefined macro -DUNICODE 
> -D_UNICODE in QEMU_CFLAGS,
> and these too macro are standard config for win32 if using windows wide api.
> 
> in cfgmgr32.h
>   CMAPI CONFIGRET WINAPI CM_Get_DevNode_PropertyW(DEVINST dnDevInst, const 
> DEVPROPKEY *PropertyKey, DEVPROPTYPE *PropertyType, PBYTE PropertyBuffer, 
> PULONG PropertyBufferSize, ULONG ulFlags);
> #ifdef UNICODE
> #define CM_Get_DevNode_Property CM_Get_DevNode_PropertyW
> #endif
> 
> macro CM_Get_DevNode_Property defined only when UNICODE are defined.
> and in win32, UNICODE and _UNICODE should be defined at the same time
> 
> #endif
> 
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> ---
>  configure | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/configure b/configure
> index 9f141891ea..f5d661af4a 100755
> --- a/configure
> +++ b/configure
> @@ -812,6 +812,7 @@ MINGW32*)
>    mingw32="yes"
>    hax="yes"
>    whpx=""
> +  QEMU_CFLAGS="-DUNICODE -D_UNICODE $QEMU_CFLAGS"

What about declaring them in include/qemu/osdep.h
instead?

-- >8 --
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 412962d91a2..cd5cedc0b21 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -74,6 +74,12 @@ extern int daemon(int, int);
 /* enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) */
 #ifdef __MINGW32__
 #define __USE_MINGW_ANSI_STDIO 1
+#ifndef UNICODE
+#define UNICODE
+#endif
+#ifndef _UNICODE
+#define _UNICODE
+#endif
 #endif

 #include <stdarg.h>
---

>    vhost_user="no"
>    audio_possible_drivers="dsound sdl"
>    if check_include dsound.h; then
> 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]