Bug 440372

Summary: kwin fails to compile with >=libglvnd-1.3.4 on Linux: "invalid conversion from ‘xcb_window_t’"
Product: [Plasma] kwin Reporter: bluescreenavenger
Component: coreAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: arojas, asturm, demm, heiko.becker, josef64, kyle.devir, luis.davila.pc, miflab, nate, rdieter
Priority: NOR    
Version: git master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: kwin-5.22.4 patch

Description bluescreenavenger 2021-07-28 22:39:24 UTC
SUMMARY

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

OBSERVED RESULT
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}


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

ADDITIONAL INFORMATION
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'.

x11: Fix build with EGL_NO_PLATFORM_SPECIFIC_TYPES

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

https://invent.kde.org/plasma/kwin/commit/839710201c389b7f4ed248cb3818e755a37ce977