Message ID | 20200307172222.14764-3-philmd@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | buildsys: Fix building with SASL on Windows | expand |
On Sat, Mar 07, 2020 at 06:22:21PM +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. > Add the definition to vnc_sasl_cflags if we are uing MinGW. > > [*] https://github.com/cyrusimap/cyrus-sasl/blob/cyrus-sasl-2.1.27/include/sasl.h#L187 > > Cc: Alexey Pavlov <alexpux@gmail.com> > Cc: Biswapriyo Nath <nathbappai@gmail.com> > Cc: Youry Metlitsky <winaes@yandex.ru> > Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> > --- > configure | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/configure b/configure > index 0c2dd1eb08..0bc87ce42a 100755 > --- a/configure > +++ b/configure > @@ -3375,7 +3375,13 @@ 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="" > + if test "$mingw32" = "yes" && test "$iovec" != "yes"; then I don't get why we need the "iovec != yes" check there ? On mingw sys/uio.h doesn't exist, so "$iovec" will always be "no", and so this conditional is equivalent to if test "$mingw32" = "yes; then If for some strange reason, a future Windows adds sys/uio.h header containing struct iovec, then QEMU won't define its own local copy if struct iovec, and so "$iovec" will be "yes". In this situation we don't want SASL to define its struct iovec either. IOW we need -DSTRUCT_IOVEC_DEFINED no matter what $iovec value is AFAICT. This would mean the previous patch is redundant too. > + # 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" > + else > + vnc_sasl_cflags="" > + fi > vnc_sasl_libs="-lsasl2" > if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then > vnc_sasl=yes Regards, Daniel
On 3/9/20 10:57 AM, Daniel P. Berrangé wrote: > On Sat, Mar 07, 2020 at 06:22:21PM +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. >> Add the definition to vnc_sasl_cflags if we are uing MinGW. >> >> [*] https://github.com/cyrusimap/cyrus-sasl/blob/cyrus-sasl-2.1.27/include/sasl.h#L187 >> >> Cc: Alexey Pavlov <alexpux@gmail.com> >> Cc: Biswapriyo Nath <nathbappai@gmail.com> >> Cc: Youry Metlitsky <winaes@yandex.ru> >> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> >> --- >> configure | 8 +++++++- >> 1 file changed, 7 insertions(+), 1 deletion(-) >> >> diff --git a/configure b/configure >> index 0c2dd1eb08..0bc87ce42a 100755 >> --- a/configure >> +++ b/configure >> @@ -3375,7 +3375,13 @@ 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="" >> + if test "$mingw32" = "yes" && test "$iovec" != "yes"; then > > I don't get why we need the "iovec != yes" check there ? > > On mingw sys/uio.h doesn't exist, so "$iovec" will always > be "no", and so this conditional is equivalent to > > if test "$mingw32" = "yes; then Indeed. > > If for some strange reason, a future Windows adds sys/uio.h > header containing struct iovec, then QEMU won't define its > own local copy if struct iovec, and so "$iovec" will be "yes". > > In this situation we don't want SASL to define its struct iovec > either. > > IOW we need -DSTRUCT_IOVEC_DEFINED no matter what $iovec value > is AFAICT. Way simpler! > > This would mean the previous patch is redundant too. Yes, thanks for reviewing :) > >> + # 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" >> + else >> + vnc_sasl_cflags="" >> + fi >> vnc_sasl_libs="-lsasl2" >> if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then >> vnc_sasl=yes > > Regards, > Daniel >
diff --git a/configure b/configure index 0c2dd1eb08..0bc87ce42a 100755 --- a/configure +++ b/configure @@ -3375,7 +3375,13 @@ 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="" + if test "$mingw32" = "yes" && test "$iovec" != "yes"; then + # 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" + else + vnc_sasl_cflags="" + fi vnc_sasl_libs="-lsasl2" if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then vnc_sasl=yes
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. Add the definition to vnc_sasl_cflags if we are uing MinGW. [*] https://github.com/cyrusimap/cyrus-sasl/blob/cyrus-sasl-2.1.27/include/sasl.h#L187 Cc: Alexey Pavlov <alexpux@gmail.com> Cc: Biswapriyo Nath <nathbappai@gmail.com> Cc: Youry Metlitsky <winaes@yandex.ru> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> --- configure | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)