Qt platform plugin "xcb"

When I try to start the application, I see an error

This application failed to start because it could not find or load the Qt platform plugin "xcb".
Available platform plugins are: linuxfb, minimal, offscreen, xcb.

As I understand it is connected with plugins QT_QPA_PLATFORM_PLUGIN_PATH
If I’m wrong, correct me.
These plugins are with the QT.
How do correctly specify the settings for them where they are located?
Thx

Hey blinct
You need desktop helper to simplify Qt-based apps snapping.
What you need to do
1) add after: [desktop-qt5] in your part
2) run your apps with desktop-launch utility

Replace the desktop-qt5 with desktop-qt4 if it’s a qt4-based app.
You probably need to run the following command to update the remote parts upfront.

$ snapcraft update

Here is a trivial example you can refer to

Thanks.

2 Likes

It’s my snapcraft.yaml

name: bsp095project
version: "1.0"
summary: timer
description: |
    Application for medical testing
confinement: devmode
grade: devel
architectures: [amd64]

apps:
    BSP095launcherCoreSimulation:
        command: bin/run.sh $SNAP/bin/start_CORE_simulation.sh
        plugs: ['home', 'x11', 'opengl', 'gsettings', 'raw-usb', 'serial-port', 'network']
#        environment:
#            LD_LIBRARY_PATH: $SNAP/usr/BTL/
#            LD_LIBRARY_PATH: $SNAP/usr/BTL/Simulation
#            LD_LIBRARY_PATH: $SNAP/QT/5.5/gcc_64/lib
    BSP095launcherCore:
        command: bin/run.sh $SNAP/bin/start_CORE_hardware.sh
        plugs: ['home', 'x11', 'opengl', 'gsettings', 'raw-usb', 'serial-port', 'network']
#        environment:
#            LD_LIBRARY_PATH: $SNAP/usr/BTL/
#            LD_LIBRARY_PATH: $SNAP/usr/BTL/CommProtV200
#            LD_LIBRARY_PATH: $SNAP/QT/5.5/gcc_64/lib
    BSP095launcherCoreDaemon:
        command: bin/run.sh $SNAP/bin/start_CORE_hardware.sh --start
        daemon: simple
        stop-command: bin/run.sh $SNAP/bin/start_CORE_hardware.sh --stop
        stop-timeout: 10s
        plugs: ['home', 'x11', 'opengl', 'gsettings', 'raw-usb', 'serial-port', 'network']
#        environment:
#            LD_LIBRARY_PATH: $SNAP/usr/BTL
#            LD_LIBRARY_PATH: $SNAP/QT/5.5/gcc_64/lib
    BSP095launcherGui:
        command: bin/run.sh $SNAP/bin/start_GUI.sh
        plugs: ['home', 'x11', 'opengl', 'gsettings', 'pulseaudio', 'network']
#        environment:
#            LD_LIBRARY_PATH: $SNAP/usr/BTL
#            LD_LIBRARY_PATH: $SNAP/QT
    BSP095launcherMaintenance:
        command: bin/run.sh $SNAP/bin/start_maintenance_hardware.sh
        plugs: ['home', 'x11', 'opengl', 'gsettings', 'pulseaudio', 'network']
#        environment:
#            LD_LIBRARY_PATH: $SNAP/usr/BTL
#            LD_LIBRARY_PATH: $SNAP/QT

parts:
    files:
        plugin: dump
        source: scripts
        after: [integration]

    integration:
        plugin: nil
        stage-packages:
            - libc-bin
            - libclutter-1.0-0
            - libxkbcommon0
            - ttf-ubuntu-font-family
            - dmz-cursor-theme
            - libglib2.0-0
            - light-themes
            - shared-mime-info
            - libqt5gui5
            - libgdk-pixbuf2.0-0
            - libqt5svg5
            - libqt5quick5
            - libsqlite0
            - libqt5sql5
            - libqt5sql5-sqlite
            - libsqlite3-0
            - appmenu-qt5
            - libqt5qml5
            - libqt5quickwidgets5
            - qml-module-qtquick-controls
            - qml-module-qtqml-models2
            - qmlscene
            - qml-module-qt-labs-folderlistmodel
            - qml-module-qtquick-xmllistmodel
        after: [desktop/qt5]

I’m using the commercial version QT 5.5

You need to use the desktop-launch wrapper script to launch your app, as shown in @gary-wzl’s example. This is what takes care of setting the environment variables for you.

run.sh it’s renamed desktop-launch

So your run.sh is identical to the script that the cloud part would generate for you? Because the desktop-launch from the part definitely sets the relevant environment variables:

In this file I have such lines.
And yes, you are right, this is the generated file.