[PATCH] ui/spice: fix compilation on win32

marcandre.lureau@redhat.com posted 1 patch 1 year ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230322075256.2043812-1-marcandre.lureau@redhat.com
Maintainers: Gerd Hoffmann <kraxel@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>
ui/spice-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] ui/spice: fix compilation on win32
Posted by marcandre.lureau@redhat.com 1 year ago
From: Marc-André Lureau <marcandre.lureau@redhat.com>

qemu_close_to_socket() renaming left-over.

Fixes:
https://gitlab.com/qemu-project/qemu/-/issues/1553

Fixes: commit e40283d9a ("ui/spice: fix SOCKET handling regression")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 ui/spice-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui/spice-core.c b/ui/spice-core.c
index 67cfd3ca9c..52a59386d7 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -149,7 +149,7 @@ static void watch_remove(SpiceWatch *watch)
     qemu_set_fd_handler(watch->fd, NULL, NULL, NULL);
 #ifdef WIN32
     /* SOCKET is owned by spice */
-    qemu_close_to_socket(watch->fd);
+    qemu_close_socket_osfhandle(watch->fd);
 #endif
     g_free(watch);
 }
-- 
2.39.2


Re: [PATCH] ui/spice: fix compilation on win32
Posted by Thomas Huth 1 year ago
On 22/03/2023 08.52, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> qemu_close_to_socket() renaming left-over.
> 
> Fixes:
> https://gitlab.com/qemu-project/qemu/-/issues/1553
> 
> Fixes: commit e40283d9a ("ui/spice: fix SOCKET handling regression")
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   ui/spice-core.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/ui/spice-core.c b/ui/spice-core.c
> index 67cfd3ca9c..52a59386d7 100644
> --- a/ui/spice-core.c
> +++ b/ui/spice-core.c
> @@ -149,7 +149,7 @@ static void watch_remove(SpiceWatch *watch)
>       qemu_set_fd_handler(watch->fd, NULL, NULL, NULL);
>   #ifdef WIN32
>       /* SOCKET is owned by spice */
> -    qemu_close_to_socket(watch->fd);
> +    qemu_close_socket_osfhandle(watch->fd);
>   #endif
>       g_free(watch);
>   }

Reviewed-by: Thomas Huth <thuth@redhat.com>

I can queue this for my next pull request together with Philippe's Msys2 CI 
patches (unless you plan a pull request for this already anyway).

  Thomas


Re: [PATCH] ui/spice: fix compilation on win32
Posted by Philippe Mathieu-Daudé 1 year ago
On 22/3/23 08:52, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> qemu_close_to_socket() renaming left-over.
> 
> Fixes:
> https://gitlab.com/qemu-project/qemu/-/issues/1553
> 

Reported-by: Jintao Yin <nicememory@gmail.com>

> Fixes: commit e40283d9a ("ui/spice: fix SOCKET handling regression")
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   ui/spice-core.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/ui/spice-core.c b/ui/spice-core.c
> index 67cfd3ca9c..52a59386d7 100644
> --- a/ui/spice-core.c
> +++ b/ui/spice-core.c
> @@ -149,7 +149,7 @@ static void watch_remove(SpiceWatch *watch)
>       qemu_set_fd_handler(watch->fd, NULL, NULL, NULL);
>   #ifdef WIN32
>       /* SOCKET is owned by spice */
> -    qemu_close_to_socket(watch->fd);
> +    qemu_close_socket_osfhandle(watch->fd);
>   #endif
>       g_free(watch);
>   }


Re: [PATCH] ui/spice: fix compilation on win32
Posted by Philippe Mathieu-Daudé 1 year ago
On 22/3/23 08:52, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> qemu_close_to_socket() renaming left-over.
> 
> Fixes:
> https://gitlab.com/qemu-project/qemu/-/issues/1553
> 
> Fixes: commit e40283d9a ("ui/spice: fix SOCKET handling regression")
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   ui/spice-core.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/ui/spice-core.c b/ui/spice-core.c
> index 67cfd3ca9c..52a59386d7 100644
> --- a/ui/spice-core.c
> +++ b/ui/spice-core.c
> @@ -149,7 +149,7 @@ static void watch_remove(SpiceWatch *watch)
>       qemu_set_fd_handler(watch->fd, NULL, NULL, NULL);
>   #ifdef WIN32
>       /* SOCKET is owned by spice */
> -    qemu_close_to_socket(watch->fd);
> +    qemu_close_socket_osfhandle(watch->fd);
>   #endif
>       g_free(watch);
>   }

Wondering why this hasn't been caught by CI, apparently we miss
the spice package:

-- >8 --
diff --git a/.cirrus.yml b/.cirrus.yml
@@ -41,6 +41,7 @@ windows_msys2_task:
        mingw-w64-x86_64-curl
        mingw-w64-x86_64-gnutls
        mingw-w64-x86_64-libnfs
+      mingw-w64-x86_64-spice
      "
      CHERE_INVOKING: 1
    msys2_cache:
---

Re: [PATCH] ui/spice: fix compilation on win32
Posted by Marc-André Lureau 1 year ago
Hi

On Wed, Mar 22, 2023 at 1:01 PM Philippe Mathieu-Daudé
<philmd@linaro.org> wrote:
>
> On 22/3/23 08:52, marcandre.lureau@redhat.com wrote:
> > From: Marc-André Lureau <marcandre.lureau@redhat.com>
> >
> > qemu_close_to_socket() renaming left-over.
> >
> > Fixes:
> > https://gitlab.com/qemu-project/qemu/-/issues/1553
> >
> > Fixes: commit e40283d9a ("ui/spice: fix SOCKET handling regression")
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >   ui/spice-core.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/ui/spice-core.c b/ui/spice-core.c
> > index 67cfd3ca9c..52a59386d7 100644
> > --- a/ui/spice-core.c
> > +++ b/ui/spice-core.c
> > @@ -149,7 +149,7 @@ static void watch_remove(SpiceWatch *watch)
> >       qemu_set_fd_handler(watch->fd, NULL, NULL, NULL);
> >   #ifdef WIN32
> >       /* SOCKET is owned by spice */
> > -    qemu_close_to_socket(watch->fd);
> > +    qemu_close_socket_osfhandle(watch->fd);
> >   #endif
> >       g_free(watch);
> >   }
>
> Wondering why this hasn't been caught by CI, apparently we miss
> the spice package:
>
> -- >8 --
> diff --git a/.cirrus.yml b/.cirrus.yml
> @@ -41,6 +41,7 @@ windows_msys2_task:
>         mingw-w64-x86_64-curl
>         mingw-w64-x86_64-gnutls
>         mingw-w64-x86_64-libnfs
> +      mingw-w64-x86_64-spice
>       "
>       CHERE_INVOKING: 1
>     msys2_cache:
> ---

Can you send a patch? I will trigger CI to check it.


-- 
Marc-André Lureau
Re: [PATCH] ui/spice: fix compilation on win32
Posted by Philippe Mathieu-Daudé 1 year ago
On 22/3/23 11:22, Marc-André Lureau wrote:
> Hi
> 
> On Wed, Mar 22, 2023 at 1:01 PM Philippe Mathieu-Daudé
> <philmd@linaro.org> wrote:
>>
>> On 22/3/23 08:52, marcandre.lureau@redhat.com wrote:
>>> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>>>
>>> qemu_close_to_socket() renaming left-over.
>>>
>>> Fixes:
>>> https://gitlab.com/qemu-project/qemu/-/issues/1553
>>>
>>> Fixes: commit e40283d9a ("ui/spice: fix SOCKET handling regression")
>>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>>> ---
>>>    ui/spice-core.c | 2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/ui/spice-core.c b/ui/spice-core.c
>>> index 67cfd3ca9c..52a59386d7 100644
>>> --- a/ui/spice-core.c
>>> +++ b/ui/spice-core.c
>>> @@ -149,7 +149,7 @@ static void watch_remove(SpiceWatch *watch)
>>>        qemu_set_fd_handler(watch->fd, NULL, NULL, NULL);
>>>    #ifdef WIN32
>>>        /* SOCKET is owned by spice */
>>> -    qemu_close_to_socket(watch->fd);
>>> +    qemu_close_socket_osfhandle(watch->fd);
>>>    #endif
>>>        g_free(watch);
>>>    }
>>
>> Wondering why this hasn't been caught by CI, apparently we miss
>> the spice package:
>>
>> -- >8 --
>> diff --git a/.cirrus.yml b/.cirrus.yml
>> @@ -41,6 +41,7 @@ windows_msys2_task:
>>          mingw-w64-x86_64-curl
>>          mingw-w64-x86_64-gnutls
>>          mingw-w64-x86_64-libnfs
>> +      mingw-w64-x86_64-spice
>>        "
>>        CHERE_INVOKING: 1
>>      msys2_cache:
>> ---
> 
> Can you send a patch? I will trigger CI to check it.

I was waiting the job to complete. It is sufficient to reproduce:

[1851/5253] Compiling C object libcommon.fa.p/ui_spice-core.c.obj
FAILED: libcommon.fa.p/ui_spice-core.c.obj
"cc" "-m64" "-mcx16" "-Ilibcommon.fa.p" "-I../dtc/libfdt" 
"-IC:/tools/msys64/mingw64/include/pixman-1" 
"-IC:/tools/msys64/mingw64/include/libpng16" 
"-IC:/tools/msys64/mingw64/include/spice-server" 
"-IC:/tools/msys64/mingw64/include/spice-1" 
"-IC:/tools/msys64/mingw64/include/glib-2.0" 
"-IC:/tools/msys64/mingw64/lib/glib-2.0/include" 
"-IC:/tools/msys64/mingw64/include/p11-kit-1" 
"-IC:/tools/msys64/mingw64/include/SDL2" 
"-IC:/tools/msys64/mingw64/include/ncursesw" 
"-IC:/tools/msys64/mingw64/include/gtk-3.0" 
"-IC:/tools/msys64/mingw64/include/pango-1.0" 
"-IC:/tools/msys64/mingw64/include/harfbuzz" 
"-IC:/tools/msys64/mingw64/include/freetype2" 
"-IC:/tools/msys64/mingw64/include/fribidi" 
"-IC:/tools/msys64/mingw64/include/cairo" 
"-IC:/tools/msys64/mingw64/include/gdk-pixbuf-2.0" 
"-IC:/tools/msys64/mingw64/include/webp" 
"-IC:/tools/msys64/mingw64/include/atk-1.0" 
"-IC:/tools/msys64/mingw64/include/libusb-1.0" 
"-fdiagnostics-color=auto" "-Wall" "-Winvalid-pch" "-Werror" 
"-std=gnu11" "-O2" "-g" "-iquote" "." "-iquote" 
"C:/Users/ContainerAdministrator/AppData/Local/Temp/cirrus-ci-build" 
"-iquote" 
"C:/Users/ContainerAdministrator/AppData/Local/Temp/cirrus-ci-build/include" 
"-iquote" 
"C:/Users/ContainerAdministrator/AppData/Local/Temp/cirrus-ci-build/tcg/i386" 
"-U_FORTIFY_SOURCE" "-D_FORTIFY_SOURCE=2" "-fno-pie" "-no-pie" 
"-D_GNU_SOURCE" "-D_FILE_OFFSET_BITS=64" "-D_LARGEFILE_SOURCE" 
"-fno-strict-aliasing" "-fno-common" "-fwrapv" "-Wundef" 
"-Wwrite-strings" "-Wmissing-prototypes" "-Wstrict-prototypes" 
"-Wredundant-decls" "-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" "-Wimplicit-fallthrough=2" 
"-Wmissing-format-attribute" "-Wno-missing-include-dirs" 
"-Wno-shift-negative-value" "-Wno-psabi" "-fstack-protector-strong" 
"-DHWY_SHARED_DEFINE" "-DLIBDEFLATE_DLL" "-D_POSIX_C_SOURCE=199506L" 
"-DNCURSES_WIDECHAR" "-DNCURSES_WIDECHAR=1" "-Dmain=SDL_main" 
"-Wno-undef" "-DSTRUCT_IOVEC_DEFINED" -MD -MQ 
libcommon.fa.p/ui_spice-core.c.obj -MF 
"libcommon.fa.p/ui_spice-core.c.obj.d" -o 
libcommon.fa.p/ui_spice-core.c.obj "-c" ../ui/spice-core.c
../ui/spice-core.c: In function 'watch_remove':
../ui/spice-core.c:152:5: error: implicit declaration of function 
'qemu_close_to_socket' [-Werror=implicit-function-declaration]
   152 |     qemu_close_to_socket(watch->fd);
       |     ^~~~~~~~~~~~~~~~~~~~
../ui/spice-core.c:152:5: error: nested extern declaration of 
'qemu_close_to_socket' [-Werror=nested-externs]
cc1.exe: all warnings being treated as errors

ninja: build stopped: subcommand failed.
make: *** [Makefile:165: run-ninja] Error 1
Exit status: 2


Re: [PATCH] ui/spice: fix compilation on win32
Posted by Philippe Mathieu-Daudé 1 year ago
On 22/3/23 08:52, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> qemu_close_to_socket() renaming left-over.
> 
> Fixes:
> https://gitlab.com/qemu-project/qemu/-/issues/1553
> 
> Fixes: commit e40283d9a ("ui/spice: fix SOCKET handling regression")
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   ui/spice-core.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>