flathub / io.github.simple64.simple64

https://flathub.org/apps/details/io.github.simple64.simple64
2 stars 1 forks source link

Could not load the Qt platform plugin "xcb" #80

Closed jonian closed 1 month ago

jonian commented 5 months ago

Hi, the application fails to launch on Arch Linux with GNOME 46 on Wayland with the error below.

qt.qpa.xcb: could not connect to display 
qt.qpa.plugin: From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin.
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb, vnc, linuxfb, eglfs, offscreen, minimal, wayland-egl, minimalegl, wayland, vkkhrdisplay.
waeada commented 4 months ago

Hi, are you using the cv2 module? If you are using it, it's possible that cv2 is conflicting with pyqt, installing the headless cv2 library can solve this problem.

jonian commented 4 months ago

Hi, thanks for the reply. If by cv2 you mean opencv, no I don't have it installed.

loganmc10 commented 1 month ago

This is not a bug specific to simple64, something is wrong with the flatpak Qt setup on your machine, but I don't think it is related to this package

jonian commented 1 month ago

Other emulators in Qt like Dolphin, Duck Station and Rosalie's Mupen GUI work without issues. Don't think it is an issue with my setup.

loganmc10 commented 1 month ago

Are you using the flatpak? Or did you install it from AUR?

jonian commented 1 month ago

I'm using the flatpak. Screenshot From 2024-10-08 23-05-30

loganmc10 commented 1 month ago

It is something wrong with your setup, for example, I get the same error as you if I do this:

QT_QPA_PLATFORM=xcb flatpak run io.github.simple64.simple64

Because I am trying to force the X11 backend for Qt when Wayland is available

This works:

QT_QPA_PLATFORM=xcb flatpak run --nosocket=wayland io.github.simple64.simple64

Because I am disabling the Wayland socket for flatpak and then forcing the X11 backend for Qt. So there appears to be something wrong with your Wayland+Flatpak setup

loganmc10 commented 1 month ago

You could also try this (this also works for me):

QT_QPA_PLATFORM=wayland flatpak run io.github.simple64.simple64

But I would think this shouldn't make a difference, since wayland should already be the default

jonian commented 1 month ago

Yes I have QT_QPA_PLATFORM=xcb in /etc/environment to force X11 on Qt apps. And yes using the command below it works,

QT_QPA_PLATFORM=wayland flatpak run io.github.simple64.simple64
loganmc10 commented 1 month ago

Right, so that is your problem. The application uses the permission --socket=fallback-x11, meaning that it only exposes X11 support if Wayland is not available. Since your system supports Wayland, it is not seeing X11 support, but you are forcing the QT_QPA_PLATFORM to use X11. You can use Flatseal to remove the Wayland permission from simple64, which would then expose X11 support

loganmc10 commented 1 month ago

I just checked, and both Dolphin and RMG are only exposing X11 support, not Wayland, which is why you don't have issues with those emulators, but you'll probably have issues with any Qt application that is configured to use Wayland (as a flatpak).

jonian commented 1 month ago

You are answering my questions as I write them :smile:. Thanks for the solution!