blinct
June 28, 2017, 8:31am
1
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
icon: snap/gui/qt5-application.png apps: qt5-application: environment: # Use GTK3 cursor theme, icon theme and open/save file dialogs. QT_QPA_PLATFORMTHEME: gtk3 command: desktop-launch application plugs: [unity7, home] parts: application: source: src/ plugin: qmake qt-version: qt5 after: [desktop-qt5] # This part installs the qt5 dependencies and the `desktop-launch` script # which initialises desktop features such as fonts, themes and the XDG # environment. #
Thanks.
2 Likes
blinct
June 28, 2017, 10:02am
3
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
jamesh
June 28, 2017, 10:27am
4
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.
blinct
June 28, 2017, 10:30am
5
jamesh:
desktop-launch
run.sh it’s renamed desktop-launch
jamesh
June 28, 2017, 1:00pm
6
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:
if [ "$USE_qt5" = true ]; then prepend_dir QT_PLUGIN_PATH $RUNTIME/usr/lib/$ARCH/qt5/plugins prepend_dir QML2_IMPORT_PATH $RUNTIME/usr/lib/$ARCH/qt5/qml prepend_dir QML2_IMPORT_PATH $RUNTIME/lib/$ARCH # Try to use qtubuntu-print plugin, if not found Qt will fallback to the first found (usually cups plugin) export QT_PRINTER_MODULE=qtubuntu-print if [ "$WITH_RUNTIME" = yes ]; then prepend_dir QML2_IMPORT_PATH $SNAP/usr/lib/$ARCH/qt5/qml prepend_dir QML2_IMPORT_PATH $SNAP/lib/$ARCH fi
blinct
June 29, 2017, 6:58am
7
In this file I have such lines.
And yes, you are right, this is the generated file.