freeciv21 icon indicating copy to clipboard operation
freeciv21 copied to clipboard

Running freeciv on ChromeOS through dev environment w/flatpak -- QT_QPA_PLATFORM

Open 3dsf opened this issue 1 year ago • 4 comments

Describe the bug An error is generated when running freeciv through flatpak on cmdline, and populated icons in the launcher do not work. flatpak run net.longturn.freeciv21

qt.qpa.xcb: could not connect to display 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: eglfs, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, xcb.

To Reproduce Steps to reproduce the behavior:

  1. Install flatpak in the dev environment
  2. Add flathub repo
  3. Shutdown linux dev enviroment
  4. Open linux dev enviroment
  5. Install freeciv flatpak

Expected behavior Launcher icons to work and for it to work from cmd line

Platform and version (please complete the following information):

  • OS: ChromeOS dev environment

Additional context This cmdline and a reboot should fix it locally flatpak override --user --env=QT_QPA_PLATFORM=wayland net.longturn.freeciv21

3dsf avatar Jan 04 '24 08:01 3dsf

The flatpak is compiled to x86_64

jwrober avatar Jan 04 '24 14:01 jwrober

I guess it self-bifurcated to aarch64?

Screenshot 2024-01-04 10 30 19 It pulls about 1 GB in packages on first call to build the required environment, which is normal for a first flatpak install

And now this thread exists to help someone else.

I also suspect this could be addressed with a flatpak build option, but I am not strong with flatpaks.

3dsf avatar Jan 04 '24 18:01 3dsf

I guess it self-bifurcated to aarch64?

aarch64 and arm64 usually refer to the same thing, the difference is mostly there to confuse people :sweat_smile: The FlatHub bot builds both x86 and ARM binaries.

lmoureaux avatar Jan 04 '24 18:01 lmoureaux

Qt checks the following variables when selecting its platform plugin:

  • XDG_SESSION_TYPE=x11|wayland
  • QT_QPA_PLATFORM as you mentioned

I could reproduce your error by unsetting XDG_SESSION_TYPE or setting it to x11 even though I'm on Wayland. This happens with Kde applications as well (tried org.kde.kcalc). For instance:

$ (unset XDG_SESSION_TYPE; flatpak run org.kde.kcalc)
qt.qpa.xcb: could not connect to display 
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: eglfs, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

--> this is likely a problem with your setup or desktop environment edit: or the Kde platform for flatpak

lmoureaux avatar Jan 04 '24 22:01 lmoureaux