Bug 440372 - kwin fails to compile with >=libglvnd-1.3.4 on Linux: "invalid conversion from ‘xcb_window_t’"
Summary: kwin fails to compile with >=libglvnd-1.3.4 on Linux: "invalid conversion fro...
Alias: None
Product: kwin
Classification: Plasma
Component: core (show other bugs)
Version: git master
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
: 441980 (view as bug list)
Depends on:
Reported: 2021-07-28 22:39 UTC by bluescreenavenger
Modified: 2021-09-13 06:37 UTC (History)
10 users (show)

See Also:
Latest Commit:
Version Fixed In:

kwin-5.22.4 patch (657 bytes, patch)
2021-08-27 07:34 UTC, miflab

Note You need to log in before you can comment on or make changes to this bug.
Description bluescreenavenger 2021-07-28 22:39:24 UTC

It seems recently due to some EGL changes, I can't compile kwin anymore

I get the below log snip:
[ 68%] Building CXX object src/plugins/platforms/wayland/CMakeFiles/KWinWaylandWaylandBackend.dir/egl_wayland_backend.cpp.o
[ 68%] Building CXX object src/plugins/platforms/drm/CMakeFiles/KWinWaylandDrmBackend.dir/egl_stream_backend.cpp.o
[ 68%] Building CXX object src/plugins/platforms/wayland/CMakeFiles/KWinWaylandWaylandBackend.dir/logging.cpp.o
[ 68%] Building CXX object src/plugins/platforms/wayland/CMakeFiles/KWinWaylandWaylandBackend.dir/scene_qpainter_wayland_backend.cpp.o
In file included from /srcbuild/kwin/src/abstract_wayland_output.h:13,
                 from /srcbuild/kwin/src/plugins/platforms/virtual/virtual_output.h:12,
                 from /srcbuild/kwin/src/plugins/platforms/virtual/virtual_output.cpp:9:
/srcbuild/kwin/src/utils.h:134:92: warning: ‘visibility’ attribute ignored [-Wattributes]
  134 | static inline QRegion KWIN_EXPORT mapRegion(const QMatrix4x4 &matrix, const QRegion &region)
      |                                                                                            ^
[ 68%] Building CXX object src/plugins/platforms/wayland/CMakeFiles/KWinWaylandWaylandBackend.dir/wayland_backend.cpp.o
[ 68%] Building CXX object src/plugins/platforms/virtual/CMakeFiles/KWinWaylandVirtualBackend.dir/logging.cpp.o
/srcbuild/kwin/src/plugins/platforms/x11/common/eglonxbackend.cpp: In member function ‘void* KWin::EglOnXBackend::createSurface(xcb_window_t)’:
/srcbuild/kwin/src/plugins/platforms/x11/common/eglonxbackend.cpp:224:66: error: invalid conversion from ‘xcb_window_t’ {aka ‘unsigned int’} to ‘EGLNativeWindowType’ {aka ‘void*’} [-fpermissive]
  224 |         surface = eglCreateWindowSurface(eglDisplay(), config(), window, nullptr);
      |                                                                  ^~~~~~
      |                                                                  |
      |                                                                  xcb_window_t {aka unsigned int}

Linux/KDE Plasma: master
(available in About System)
KDE Plasma Version: master
KDE Frameworks Version: master
Qt Version: 5.15

cmake configure finds everything
Comment 1 Nate Graham 2021-07-29 14:38:20 UTC
huh, it compiles fine for me.
Comment 2 bluescreenavenger 2021-07-29 23:28:15 UTC
I wonder if it's some other package that caused the build to break, but I am not sure which one, doesn't appear to Mesa
Comment 3 bluescreenavenger 2021-07-30 02:15:43 UTC
diff --git a/src/plugins/platforms/x11/common/eglonxbackend.cpp b/src/plugins/platforms/x11/common/eglonxbackend.cpp                                                                                                                                                           
index c62ec170d..33b75eee1 100644                                                                                                                                                                                                                                              
--- a/src/plugins/platforms/x11/common/eglonxbackend.cpp                                                                                                                                                                                                                       
+++ b/src/plugins/platforms/x11/common/eglonxbackend.cpp                                                                                                                                                                                                                       
@@ -221,7 +221,7 @@ EGLSurface EglOnXBackend::createSurface(xcb_window_t window)                                                                                                                                                                                               
         //       cannot be an xcb_window_t.                                                                                                                                                                                                                                   
         surface = eglCreatePlatformWindowSurfaceEXT(eglDisplay(), config(), (void *) &window, nullptr);                                                                                                                                                                       
     } else {                                                                                                                                                                                                                                                                  
-        surface = eglCreateWindowSurface(eglDisplay(), config(), window, nullptr);                                                                                                                                                                                            
+        surface = eglCreateWindowSurface(eglDisplay(), config(), &window, nullptr);
     return surface;

works, gets kwin to compile. I just tried it, but what's weird is that git blame says that whole if statement was last touched in 2015
Comment 4 miflab 2021-08-27 07:34:14 UTC
Created attachment 141082 [details]
kwin-5.22.4 patch

Can confirm on Gentoo with kwin-5.22.4, reproducible both with gcc-11.2.0 and clang-12.0.1.
Attached patch solved the error. Basically it's just updated bluescreenavenger's patch which adds void* cast for eglCreateWindowSurface call, similar to eglCreatePlatformWindowSurfaceEXT call.
Comment 5 Andreas Sturmlechner 2021-08-27 11:46:57 UTC
Issue was introduced with libglvnd-1.3.4.

See also downstream report with complete build.log: https://bugs.gentoo.org/810511
Comment 7 Andreas Sturmlechner 2021-09-01 12:58:28 UTC
(In reply to miflab from comment #4)
> Created attachment 141082 [details]
> kwin-5.22.4 patch

FYI, patch is not backwards compatible with libglvnd-1.3.3.
Comment 8 Kyle Devir 2021-09-04 08:34:42 UTC
*** Bug 441980 has been marked as a duplicate of this bug. ***
Comment 9 Bug Janitor Service 2021-09-10 10:49:43 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/1404
Comment 10 Vlad Zahorodnii 2021-09-10 14:58:15 UTC
Can somebody please test !1404?
Comment 11 Antonio Rojas 2021-09-10 16:36:51 UTC
(In reply to Vlad Zahorodnii from comment #10)
> Can somebody please test !1404?

Works for me
Comment 12 Vlad Zahorodnii 2021-09-13 06:37:33 UTC
Git commit 839710201c389b7f4ed248cb3818e755a37ce977 by Vlad Zahorodnii.
Committed on 13/09/2021 at 06:37.
Pushed by vladz into branch 'master'.


eglCreateWindowSurface() wants a Window (unsigned long), but with
EGL_NO_PLATFORM_SPECIFIC_TYPES, EGLNativeWindowType is defined as an
opaque pointer, i.e. void*.

M  +7    -6    src/plugins/platforms/x11/common/eglonxbackend.cpp