Problems with deps, snap core22 and qt6

Hello everybody, I’m trying to run snap (and snapcraft) properly but I’ve some troubles with the stage-packages stuff.

This is my snapcraft.yaml:

I commented out the part with qt6-qpa-plugins, qt6-wayland, and other platform integrations.

The snap is built but it won’t start, I have the following output:

qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Aborted (core dumped)

I tried also with QT_DEBUG_PLUGINS=1 as seen in this post: Cannot use Qt6 in classic core22 snap, rebuilding with qt6-qpa-plugins dependency and some others, same results.

Any idea?

Hi there! Welcome to the Snapcraft forum :slight_smile:

It looks like your snap isn’t referencing any of the desktop interfaces, so it doesn’t have permission to talk to your X or Wayland server.

If you extend your snapcraft.yaml so the apps section looks something like:

apps:
  e2-sat-editor:
    command: e2-sat-editor
    plugs:
    - desktop
    - desktop-legacy
    - wayland
    - x11
    - unity7

it should start the application (or at least get you a different error message :slight_smile: ).

1 Like

Thank you! I added desktop interface to snapcraft.yaml, but same result.

I’m investigating further, it seems there is a wrong QT_QPA_PLATFORM_PLUGIN_PATH out-of-the-box, /x1/usr/bin/platforms.

Result:

2023-05-13 13:07:30.345085 <Debug> [e2se.gui] gui::gui
QFactoryLoader::QFactoryLoader() checking directory path "/snap/e2-sat-editor/x1/usr/bin/platforms" ...
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Aborted (core dumped)

Platform plugins have been installed in /current/usr/lib/x86_64-linux-gnu/qt6/plugins. So I tried to fix the path and re-run it.

Commands:

# snap run --shell e2-sat-editor

$ export QT_DEBUG_PLUGINS=1
$ export QT_QPA_PLATFORM_PLUGIN_PATH=/snap/e2-sat-editor/current/usr/lib/x86_64-linux-gnu/qt6/plugins
$ export QT_PLATFORM_PLUGIN=wayland

$ e2-sat-editor

Result (truncated):

2023-05-13 13:16:27.877698 <Debug> [e2se.gui] gui::gui
QFactoryLoader::QFactoryLoader() checking directory path "/snap/e2-sat-editor/x1/usr/lib/x86_64-linux-gnu/qt6/plugins" ...
QFactoryLoader::QFactoryLoader() checking directory path "/snap/e2-sat-editor/x1/usr/bin/platforms" ...
QFactoryLoader::QFactoryLoader() looking at path "/snap/e2-sat-editor/x1/usr/bin/platforms" ...
"Failed to extract plugin meta data from '/snap/e2-sat-editor/x1/usr/bin/e2-sat-editor'"
	not a plugin

[truncated]

QFactoryLoader::QFactoryLoader() checking directory path "/snap/e2-sat-editor/x1/lib/x86_64-linux-gnu/qt6/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() looking at path "/snap/e2-sat-editor/x1/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqeglfs.so" ...
Found metadata in lib /snap/e2-sat-editor/x1/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqeglfs.so, metadata=

[truncated]

Got keys from plugin meta data QList("eglfs")

[truncated]

Got keys from plugin meta data QList("xcb")
QFactoryLoader::QFactoryLoader() checking directory path "/snap/e2-sat-editor/x1/usr/bin/platforms" ...
loaded library "/snap/e2-sat-editor/x1/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqwayland-generic.so"
Failed to create wl_display (No such file or directory)
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in "/snap/e2-sat-editor/current/usr/lib/x86_64-linux-gnu/qt6/plugins" 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, linuxfb, minimal, minimalegl, offscreen, vkkhrdisplay, vnc, wayland-egl, wayland, xcb.

Aborted (core dumped)

With QT_PLATFORM_PLUGIN=minimal it starts right without a screen.

Maybe missing libraries or something else? :thinking:

This line impresses me: Failed to create wl_display (No such file or directory)

Update, some interesting things.

Now it runs from a fresh installation of Ubuntu 22.04 LTS server minimal.

Xorg + budgie-desktop minimal it runs, mir + egmde it runs. But it won’t run wayland + weston.

The problem of the path QT_QPA_PLATFORM_PLUGIN_PATH remains. I found a solution from Falkon KDE’s snapcraft. Without the environment variable it doesn’t run.

In a similar way:

environment:
  QT_PLUGIN_PATH: "$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/qt6/plugins"

Note: wayland + weston it runs when is normally compiled, but not as snap build.

In the log there is also an error concerning swrast_dri.so, and the usual canberra-gtk-module soft error when it starts.

libGL error: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: swrast

I also have this problem with icons in file dialog, without icons it crashes abruptly. I’m reading this post: Freedesktop icons missing

I solved this using extensions: [gnome] as suggested in the post I linked above.

Reference here: https://snapcraft.io/docs/supported-extensions