qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Yonggang Luo <luoyonggang@gmail.com>, qemu-devel@nongnu.org
Cc: "Thomas Huth" <thuth@redhat.com>,
	"QEMU Trivial" <qemu-trivial@nongnu.org>,
	"Laurent Vivier" <laurent@vivier.eu>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>
Subject: Re: [PATCH] guest agent: Fixes for windows guest agent building on msys2/mingw
Date: Tue, 15 Sep 2020 18:41:17 +0200	[thread overview]
Message-ID: <06c76888-b2c1-866f-f6f5-78ee9a2bac0c@redhat.com> (raw)
In-Reply-To: <20200915163343.1100-1-luoyonggang@gmail.com>

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	other threads:[~2020-09-15 16:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-15 16:33 [PATCH] guest agent: Fixes for windows guest agent building on msys2/mingw Yonggang Luo
2020-09-15 16:41 ` Philippe Mathieu-Daudé [this message]
2020-09-15 17:41   ` 罗勇刚(Yonggang Luo)
2020-09-15 17:55     ` Philippe Mathieu-Daudé
2020-09-15 19:17       ` 罗勇刚(Yonggang Luo)
2020-09-16  6:47         ` Thomas Huth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=06c76888-b2c1-866f-f6f5-78ee9a2bac0c@redhat.com \
    --to=philmd@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=laurent@vivier.eu \
    --cc=luoyonggang@gmail.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).