I’m trying to create a snap package for a pre-built Qt5 application, which contains all required libraries already. That is, it works well in a portable manner as well as an AppImage.
Here is my snapcraft.yaml
:
name: myqt5prebuiltapp
version: 1.0.0
summary: App summary
description: |
App description
grade: stable
confinement: devmode
base: core18
apps:
myqt5prebuiltapp:
extensions: [ gnome-3-34 ]
command: myqt5prebuiltapp
plugs:
- home
- opengl
- network
- network-bind
- pulseaudio
- x11
- desktop
- desktop-legacy
- wayland
- gsettings
environment:
LD_LIBRARY_PATH: $SNAP/lib
parts:
myqt5prebuiltapp:
plugin: dump
source: https://url/to/my/app-Linux-x86_64.tar.gz
source-type: tar
stage-packages:
- libxkbcommon0
- libgl1
- libgl1-mesa-dri
- libgl1-mesa-glx
- libasound2
- libgdk-pixbuf2.0-0
- libpango-1.0-0
- libpangocairo-1.0-0
- libpangoft2-1.0-0
- libfontconfig1
- unity-gtk2-module
- libglib2.0-bin
- ttf-ubuntu-font-family
- dmz-cursor-theme
- light-themes
- adwaita-icon-theme
- gnome-themes-standard
- libgtk2.0-0
On app starts, although the following messages appear, most functions of the app still works.
Cannot load module /snap/documentnode/x1/gnome-platform/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules/im-wayland.so: /snap/documentnode/x1/gnome-platform/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules/im-wayland.so: undefined symbol: gdk_display_get_default_seat
/snap/documentnode/x1/gnome-platform/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules/im-wayland.so does not export GTK+ IM module API: /snap/documentnode/x1/gnome-platform/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules/im-wayland.so: undefined symbol: gdk_display_get_default_seat
ERROR: /snap/documentnode/x1/gnome-platform/usr/lib/x86_64-linux-gnu/libgtk-3-0/gtk-query-immodules-3.0 exited abnormally with status 1
Gtk-Message: 08:31:59.188: Failed to load module "canberra-gtk-module"
Gtk-Message: 08:31:59.194: Failed to load module "canberra-gtk-module"
When the app tries to open an external file URL (using QDesktopServices::openUrl("file url")
), the following error message appears, and the file cannot be opened.
user-open error: cannot create a UI: please install zenity or kdialog
It works properly when it opens a web URL, QDesktopServices::openUrl("https://google.com")
. After some investigation, I guess when opening an external file URL, QDesktopServices::openUrl
will use xdg-open
command. Before that, the snap app needs to show a dialog to ask users’ permission open the file, but it cannot find a UI library to show the dialog.
I tried add zenity
and kdialog
as stage-packages, and tried different ways from my Google search, but the same issue still exists.
Can any one point me the right direction about how to enable zenity or kdialog in the snap pacakge? Many thanks in advance.