qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2 1/2] configure: Fix building with SASL on Windows


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v2 1/2] configure: Fix building with SASL on Windows
Date: Mon, 9 Mar 2020 13:43:35 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 3/9/20 1:30 PM, Daniel P. Berrangé wrote:
On Mon, Mar 09, 2020 at 01:24:53PM +0100, Philippe Mathieu-Daudé wrote:
The Simple Authentication and Security Layer (SASL) library
re-defines the struct iovec on Win32 [*]. QEMU also re-defines
it in "qemu/osdep.h". The two definitions then clash on a MinGW
build.
We can avoid the SASL definition by defining STRUCT_IOVEC_DEFINED.
Since QEMU already defines 'struct iovec' if it is missing, add
the definition to vnc_sasl_cflags to avoid SASL re-defining it.

[*] 
https://github.com/cyrusimap/cyrus-sasl/blob/cyrus-sasl-2.1.27/include/sasl.h#L187

Cc: Alexey Pavlov <address@hidden>
Cc: Biswapriyo Nath <address@hidden>
Reported-by: Youry Metlitsky <address@hidden>
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
v2:
Since QEMU provides 'struct iovec' if missing, always define
STRUCT_IOVEC_DEFINED (danpb review).
---
  configure | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index cbf864bff1..a4cd4bccfb 100755
--- a/configure
+++ b/configure
@@ -3349,7 +3349,9 @@ if test "$vnc" = "yes" && test "$vnc_sasl" != "no" ; then
  int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
  EOF
    # Assuming Cyrus-SASL installed in /usr prefix
-  vnc_sasl_cflags=""
+  # QEMU defines struct iovec in "qemu/osdep.h",
+  # we don't want libsasl to redefine it in <sasl/sasl.h>.
+  vnc_sasl_cflags="-DSTRUCT_IOVEC_DEFINED"
    vnc_sasl_libs="-lsasl2"
    if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
      vnc_sasl=yes

This works so:

   Reviewed-by: Daniel P. Berrangé <address@hidden>


however, I'm wondering if we'd be better doing this in a more
localized place. This applies to everything we compile, but
only one place imports sasl.h, so should we instead do

    #define STRUCT_IOVEC_DEFINED
    #include <sasl/saslh.>

in vnc-auth-sasl.h, so we localize the namespace pollution.

Good idea, but we'll need to remember this fix if we ever use <sasl/sasl.h> in another header.


Regards,
Daniel





reply via email to

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