buildsys: Fix building with SASL on Windows
v2 cover buildsys: Fix building with SASL on Windows
Fix a bug reported by Youry few months ago:
https://www.mail-archive.com/[email protected]/msg625606.html
Since v1:
- addressed Daniel review (always define STRUCT_IOVEC_DEFINED)
The Fedora docker image already uses the libsasl since commit 8ea5962f286. Add the similar package to the Debian (host) image.
Philippe Mathieu-Daudé (2):
configure: Fix building with SASL on Windows tests/docker: Install SASL library to extend code coverage on amd64
configure | 4 +++- tests/docker/dockerfiles/debian-amd64.docker | 1 + 2 files changed, 4 insertions(+), 1 deletion(-)
Signature · 1 line
2.21.1
PATCH v2 1/2 configure: Fix building with SASL on Windows
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
---
v2:
Since QEMU provides 'struct iovec' if missing, always define STRUCT_IOVEC_DEFINED (danpb review).
--- configure | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
configure +3 -1
@@ -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
Signature · 1 line
2.21.1
Re: [PATCH v2 1/2] configure: Fix building with SASL on Windows
Quoted 27 lines · Philippe Mathieu-Daudé
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 definingSTRUCT_IOVEC_DEFINED. Since QEMU already defines 'struct iovec' if it is missing, add the definition tovnc_sasl_cflagsto avoid SASL re-defining it.[*] https://github.com/cyrusimap/cyrus-sasl/blob/cyrus-sasl-2.1.27/include/sasl.h#L187
Cc Alexey Pavlov <[email protected]>Cc Biswapriyo Nath <[email protected]>Reported-by Youry Metlitsky <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
v2:
Since QEMU provides 'struct iovec' if missing, always defineSTRUCT_IOVEC_DEFINED(danpb review).--- configure | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)configure +0
-0
configure if test "$vnc" = "yes" && test "$vnc_sasl" != "no" ; then · line 3357
Quoted 10 lines
configure +3
-1@@ -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:
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.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [PATCH v2 1/2] configure: Fix building with SASL on Windows
Quoted 44 lines · Daniel P. Berrangé
Quoted 27 lines · Philippe Mathieu-Daudé
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 definingSTRUCT_IOVEC_DEFINED. Since QEMU already defines 'struct iovec' if it is missing, add the definition tovnc_sasl_cflagsto avoid SASL re-defining it.[*] https://github.com/cyrusimap/cyrus-sasl/blob/cyrus-sasl-2.1.27/include/sasl.h#L187
Cc Alexey Pavlov <[email protected]>Cc Biswapriyo Nath <[email protected]>Reported-by Youry Metlitsky <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
v2:
Since QEMU provides 'struct iovec' if missing, always defineSTRUCT_IOVEC_DEFINED(danpb review).--- configure | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)configure +0
-0configure if test "$vnc" = "yes" && test "$vnc_sasl" != "no" ; then · line 3357
Quoted 10 lines
configure +3
-1@@ -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=yesThis works so:
Reviewed-by Daniel P. Berrangé <[email protected]>
Quoted 8 lines
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.
Quoted 4 lines
Regards,
Daniel
PATCH v2 2/2 tests/docker: Install SASL library to extend code coverage on amd64
In reply to Philippe Mathieu-DaudéInstall the SASL library to build the VNC SASL auth protocol code.
--- tests/docker/dockerfiles/debian-amd64.docker | 1 + 1 file changed, 1 insertion(+)
tests/docker/dockerfiles/debian-amd64.docker +1 -0
@@ -17,6 +17,7 @@ RUN apt update && \ libbz2-dev \ liblzo2-dev \ librdmacm-dev \ + libsasl2-dev \ libsnappy-dev \ libvte-dev
Signature · 1 line
2.21.1
Paolo Bonzini
AppliedQuoted 9 lines · Philippe Mathieu-Daudé
Fix a bug reported by Youry few months ago:
https://www.mail-archive.com/[email protected]/msg625606.htmlSince v1:
- addressed Daniel review (always defineSTRUCT_IOVEC_DEFINED)The Fedora docker image already uses the libsasl since commit
8ea5962f286. Add the similar package to the Debian (host) image.
Quoted 8 lines
Philippe Mathieu-Daudé (2):
configure: Fix building with SASL on Windows tests/docker: Install SASL library to extend code coverage on amd64configure | 4 +++- tests/docker/dockerfiles/debian-amd64.docker | 1 + 2 files changed, 4 insertions(+), 1 deletion(-)
Queued, thanks.
Paolo