All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Michael Roth <mdroth@linux.vnet.ibm.com>, qemu-devel@nongnu.org
Cc: Richard Henderson <richard.henderson@linaro.org>
Subject: Re: [Qemu-devel] [PATCH] build: qga: add macro to force use of native mingw32 assert()
Date: Sat, 10 Nov 2018 20:34:25 +0100	[thread overview]
Message-ID: <dc234347-1e4f-2139-bd00-26f049a007f0@amsat.org> (raw)
In-Reply-To: <20181109160014.28646-1-mdroth@linux.vnet.ibm.com>

Hi Michael,

On 11/9/18 5:00 PM, Michael Roth wrote:
> When building qemu-ga for w32 with VSS support, some parts of qemu-ga
> are not linked against glib, specifically the C++ bits used to
> create the VSS provider DLL. With 3ebee3b191e, we now define assert()
> as g_assert() for all mingw32 builds via osdep.h, which results in the
> following build breakage:
> 
>   x86_64-w64-mingw32-g++ -o qga/vss-win32/qga-vss.dll qga/vss-win32/requester.o qga/vss-win32/provider.o qga/vss-win32/install.o /home/mdroth/w/qemu4.git/qga/vss-win32/qga-vss.def  -shared -Wl,--add-stdcall-alias,--enable-stdcall-fixup -lole32 -loleaut32 -lshlwapi -luuid -static
>   qga/vss-win32/requester.o: In function `requester_freeze':
>   /home/mdroth/w/qemu4.git/qga/vss-win32/requester.cpp:284: undefined reference to `g_assertion_message_expr'
>   qga/vss-win32/requester.o: In function `requester_thaw':
>   /home/mdroth/w/qemu4.git/qga/vss-win32/requester.cpp:508: undefined reference to `g_assertion_message_expr'
>   /home/mdroth/w/qemu4.git/qga/vss-win32/requester.cpp:509: undefined reference to `g_assertion_message_expr'
>   collect2: error: ld returned 1 exit status
>   make: *** [/home/mdroth/w/qemu4.git/qga/vss-win32/Makefile.objs:10: qga/vss-win32/qga-vss.dll] Error 1
>   make: *** Waiting for unfinished jobs....
> 
> Fix this by introducing a USE_NATIVE_MINGW32_ASSERT macro that can
> be defined prior to inclusion of osdep.h in individual C/C++ files
> that don't link against glib.
> 
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
> ---
>  include/qemu/osdep.h        | 2 +-
>  qga/vss-win32/install.cpp   | 2 +-
>  qga/vss-win32/provider.cpp  | 2 +-
>  qga/vss-win32/requester.cpp | 2 +-
>  qga/vss-win32/vss-common.h  | 2 ++
>  5 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
> index 3bf48bcdec..59364bfeb0 100644
> --- a/include/qemu/osdep.h
> +++ b/include/qemu/osdep.h
> @@ -129,7 +129,7 @@ extern int daemon(int, int);
>   * code that is unreachable when features are disabled.
>   * All supported versions of Glib's g_assert() satisfy this requirement.
>   */
> -#ifdef __MINGW32__
> +#if defined(__MINGW32__) && !defined(USE_NATIVE_MINGW32_ASSERT)
>  #undef assert
>  #define assert(x)  g_assert(x)
>  #endif

OK.

> diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp
> index 6713e58670..6ed2d5930c 100644
> --- a/qga/vss-win32/install.cpp
> +++ b/qga/vss-win32/install.cpp
> @@ -10,9 +10,9 @@
>   * See the COPYING file in the top-level directory.
>   */
>  
> +#include "vss-common.h"
>  #include "qemu/osdep.h"

I don't like breaking the rule and not using "qemu/osdep.h" first.
(See below for suggestion).

>  
> -#include "vss-common.h"
>  #include <inc/win2003/vscoordint.h>
>  #include "install.h"
>  #include <wbemidl.h>
> diff --git a/qga/vss-win32/provider.cpp b/qga/vss-win32/provider.cpp
> index 72d8b0e19d..d298af91b2 100644
> --- a/qga/vss-win32/provider.cpp
> +++ b/qga/vss-win32/provider.cpp
> @@ -10,8 +10,8 @@
>   * See the COPYING file in the top-level directory.
>   */
>  
> -#include "qemu/osdep.h"
>  #include "vss-common.h"
> +#include "qemu/osdep.h"

Ditto.

>  #include <inc/win2003/vscoordint.h>
>  #include <inc/win2003/vsprov.h>
>  
> diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp
> index 5378c55d23..d239bd9598 100644
> --- a/qga/vss-win32/requester.cpp
> +++ b/qga/vss-win32/requester.cpp
> @@ -10,8 +10,8 @@
>   * See the COPYING file in the top-level directory.
>   */
>  
> -#include "qemu/osdep.h"
>  #include "vss-common.h"
> +#include "qemu/osdep.h"

Ditto.

>  #include "requester.h"
>  #include "install.h"
>  #include <inc/win2003/vswriter.h>
> diff --git a/qga/vss-win32/vss-common.h b/qga/vss-win32/vss-common.h
> index 61c170b52e..275cbb59c5 100644
> --- a/qga/vss-win32/vss-common.h
> +++ b/qga/vss-win32/vss-common.h
> @@ -13,6 +13,8 @@
>  #ifndef VSS_COMMON_H
>  #define VSS_COMMON_H
>  
> +#define USE_NATIVE_MINGW32_ASSERT

I believe you can add this in the "VSS SDK" section of the ./configure
script:

-- >8 --
diff --git a/configure b/configure
@@ -4588,7 +4588,7 @@ int main(void) { return VSS_CTX_BACKUP; }
 EOF
   if compile_prog "$vss_win32_include" "" ; then
     guest_agent_with_vss="yes"
-    QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
+    QEMU_CFLAGS="$QEMU_CFLAGS -DUSE_NATIVE_MINGW32_ASSERT
$vss_win32_include"
     libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++
-Wl,--enable-stdcall-fixup $libs_qga"
     qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb"
   else
---

What do you think?

Regards,

Phil.

> +
>  #define __MIDL_user_allocate_free_DEFINED__
>  #include <windows.h>
>  #include <shlwapi.h>
> 

  reply	other threads:[~2018-11-10 19:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-09 16:00 [Qemu-devel] [PATCH] build: qga: add macro to force use of native mingw32 assert() Michael Roth
2018-11-10 19:34 ` Philippe Mathieu-Daudé [this message]
2018-11-11  0:18   ` Michael Roth

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=dc234347-1e4f-2139-bd00-26f049a007f0@amsat.org \
    --to=f4bug@amsat.org \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.