Desktop-qt5 can not be used for remote part based on core18

Hi all,

I’m packaging my snap which will be based on core18 and pyqt5. When I tried to apply remote desktop-qt5 as a part of my snapcraft.yaml, I got the following errror:

Failed to get part information: Cannot find the definition for part 'desktop-qt5', required by part 'anki'.
Remote parts are not supported with bases, so make sure that this part is defined in the `snapcraft.yaml`

Except for importing desktop-qt5 manually, do we have a plan to support remote part of desktop-qt5 with core18?
Or, does anyone have a good example by using pyqt5 + core18?

These are version info of snaps installed as below:

multipass             0.6.0                           716   beta      canonical✓  classic
snapcraft             3.3                             2722  stable    canonical✓  classic


It is considered that the remote part feature will be superseded by the new extensions framework, unfortunately currently there’s no extension is implemented for Qt5 applications, yet.

As of now you need to define the desktop-qt5 part locally, here’s an example of snapping a Qt5 application with core18 base:


Here’s a workaround. This allows you to discover the necessary pieces to put in your yaml to make a local part out of the remote part.

mkdir -p ~/tmp/legacy
cd ~/tmp/legacy
snapcraft init
sed -i 's|base:|#base:|g' ./snap/snapcraft.yaml
snapcraft define desktop-qt5

Which will result in this output.

alan@KinkPad-K450:~/tmp/legacy$ snapcraft define desktop-qt5
Maintainer: 'Snapcraft community (https//'
Description: Helpers for gtk2, gtk3, qt4 and qt5 or gnome-platform and glib minimal launchers.
It brings the necessary code and exports for binding and using those
desktop technologies in a relocatable fashion, enabling binding with
global desktop theme, icon theme, image caching, fonts, mimetype handlers
application global menu and gsettings integration.
It also brings basics ubuntu dependency packages.
  1. add "after: [desktop-<technology>]" to your launcher:
     - gtk2, gtk3, qt4 and qt5 corresponds to their respective toolkit
       main dependencies and default choices.
     - gnome-platform is similar to gtk3 without the extra depends, it's
       meant to be used with the gnome platform which already includes those.
     - glib-only enables to compile mime types and gsettings infos. If you
       added your own graphical drivers, it will link them as well.
  2. prepend your command with "desktop-launch", like:
     commands: "desktop-launch foo" if foo is in $PATH. You can as well
     specify: "desktop-launch $SNAP/foo".
  3. add needed plugs to your application:
     - for graphical application:
       plugs: [x11 (or unity7 for appmenu integration)]. Think about adding
       opengl if you need hw acceleration.
     - if your application needs access to sound:
       plugs: [pulseaudio]
     - accessing to user's home directory:
       plugs: [home]
     - read/write to gsettings:
       plugs: [gsettings]
     - use of the shared platform snap content, first define the plug:
             interface: content
             target: gnome-platform
             default-provider: gnome-3-26-1604:gnome-3-26-1604
       and then make your apps use it:
         plugs: [gnome-3-26-1604]
       Note that an empty "gnome-platform" directory will be created for you
       in your snap.

  - build-essential
  - qtbase5-dev
  - dpkg-dev
  - FLAVOR=qt5
  plugin: make
  source-subdir: qt
  - libxkbcommon0
  - ttf-ubuntu-font-family
  - dmz-cursor-theme
  - light-themes
  - adwaita-icon-theme
  - gnome-themes-standard
  - shared-mime-info
  - libqt5gui5
  - libgdk-pixbuf2.0-0
  - libqt5svg5
  - try:
    - appmenu-qt5
  - locales-all
  - xdg-user-dirs
  - fcitx-frontend-qt5

Follow those instructions and you’re done.

1 Like

I resolved the problem with your suggestions, very appreciated. :smiley:

Another small issue is that “snapcraft define” was gone after 3.x when I typed it.

Thanks you, @Lin-Buo-Ren and @popey

1 Like

If you remove base: core18 and run snapcraft define <partname> you go down a ‘legacy’ code path which is equivalent to the snapcraft 2.x path. So should still work.

1 Like