Core 20 build with no gnome extension!

I rather unfortunately need to upgrade my succesful core18 based snap to core20. The snap used the gnome-3-34 extension to satisfy the demands of a GUI based snap running on a desktop pc. However it is not possible to use this extension on core20, and despite my attempts to duplicate the required functionality of the extension the core20 based version of my snap does not run properly.

On startup, the following warnings appear:

(process:36516): Gtk-WARNING **: 15:20:52.271: Locale not supported by C library.
	Using the fallback 'C' locale.
Gtk-Message: 15:20:52.486: Failed to load module "canberra-gtk-module"
Gtk-Message: 15:20:52.496: Failed to load module "canberra-gtk-module"

The snap starts normally, however when I attempt to open a standard file chooser dialogue from within the snap I get the following crash report:


(java:36516): GLib-GIO-WARNING **: 15:21:12.099: Error creating IO channel for /proc/self/mountinfo: Permission denied (g-file-error-quark, 2)

(java:36516): Gtk-WARNING **: 15:21:12.115: Could not find the icon 'user-home-symbolic-ltr'. The 'hicolor' theme
was not found either, perhaps you need to install it.
You can get a copy from:
	http://icon-theme.freedesktop.org/releases

(java:36516): Gtk-WARNING **: 15:21:12.115: Could not load a pixbuf from /org/gtk/libgtk/icons/16x16/status/image-missing.png.
This may indicate that pixbuf loaders or the mime database could not be found.
**
Gtk:ERROR:../../../../gtk/gtkiconhelper.c:494:ensure_surface_for_gicon: assertion failed (error == NULL): Failed to load /org/gtk/libgtk/icons/16x16/status/image-missing.png: Unrecognized image file format (gdk-pixbuf-error-quark, 3)
Bail out! Gtk:ERROR:../../../../gtk/gtkiconhelper.c:494:ensure_surface_for_gicon: assertion failed (error == NULL): Failed to load /org/gtk/libgtk/icons/16x16/status/image-missing.png: Unrecognized image file format (gdk-pixbuf-error-quark, 3)
Aborted (core dumped)

My snapcraft.yaml file is as follows:

name: photonotebook
title: PhotoNoteBook
version: "1.3.4"
summary: A digital photography library manager and notebook 
license: Proprietary
description: PhotoNoteBook is a digital photograph library manager enabling collections of images and the making of notes and memo's for the collections and the photographs. 
icon: photonotebook.png 

confinement: strict
grade: stable
base: core20 
 
 
apps:
  photonotebook:
    command: bin/photonotebook
    plugs:
       gtk-3-themes:
          interface: content
          target: $SNAP/share/themes
          default-provider: gtk-common-themes
       icon-themes:
          interface: content
          target: $SNAP/share/icons
          default-provider: gtk-common-themes
       sound-themes:
       interface: content
       target: $SNAP/share/sounds
       default-provider: gtk-common-themes
    
    plugs: [home, unity7,  opengl, network, removable-media, optical-drive ,desktop, desktop-legacy, gsettings, x11, wayland]
     
parts:
  photonotebook:
    plugin: dump
    source: ./photonotebook/
    stage-packages: [libgif7, libx11-6, libxext6, libxi6, libxrender1, libxtst6, libasound2, libjpeg8, liblcms2-2, libfreetype6, libpng16-16, libcanberra-gtk-module, libcanberra-gtk3-module, fontconfig-config, fonts-liberation,
ttf-dejavu-core, ttf-ubuntu-font-family,libgtk-3-0, adwaita-icon-theme-full, gnome-icon-theme, hicolor-icon-theme, gtk2-engines-pixbuf]

I realise that trying to duplicate the functionality of the gnome-3-34 extension is likely to be a little complex, and I note that others have had similar issues, but I have found no solution.

All suggestions will be very gratefully received, as at the moment I have a snap with a growing user base and no way to maintain or improve it.

cheers
Alan

We are working on an updated gnome extension and platform snaps for core20, but nothing usable yet. I’ll respond here when we have something to test.

You will need a launch script to setup some things necessary to run your app. Perhaps manually adding a desktop-gtk3 part like this:

desktop-gtk3:
    source: https://github.com/ubuntu/snapcraft-desktop-helpers.git
    source-type: git
    source-subdir: gtk
    plugin: make
    make-parameters: ["FLAVOR=gtk3"]
    build-packages:
      - libgtk-3-dev
    stage-packages:
      - libxkbcommon0  # XKB_CONFIG_ROOT
      - ttf-ubuntu-font-family
      - dmz-cursor-theme
      - light-themes
      - adwaita-icon-theme
      - gnome-themes-standard
      - shared-mime-info
      - libgtk-3-0
      - libgdk-pixbuf2.0-0
      - libglib2.0-bin
      - libgtk-3-bin
      - unity-gtk3-module
      - libappindicator3-1
      - locales-all
      - xdg-user-dirs
      - ibus-gtk3
      - libibus-1.0-5

And this to the app section:

apps:
  photonotebook:
    command: bin/photonotebook
    command-chain: [bin/desktop-launch]
2 Likes

Hi Kenvandine,
well that seems to work - I will give it a more thorough test tomorrow but at least it doesn’t crash when opening a file chooser.

The resulting snap has increased dramatically in size, from 128 MB to 306 MB so I suspect some library duplication - I’m afraid my knowledge of how the snap libs are put together is severely limited so I would welcome any advice on reducing the size of the snap. All suggestions very gratefully accepted!

Following your advice I have implemented the snapcraft.yaml file as follows:

title: PhotoNoteBook
version: "1.3.4"
summary: A digital photography library manager and notebook 
license: Proprietary
description: PhotoNoteBook is a digital photograph library manager enabling collections of images and the making of notes and memo's for the collections and the photographs. 
icon: photonotebook.png 

confinement: strict
grade: stable
base: core20 

 
apps:
  photonotebook:
    command: bin/photonotebook
    command-chain: [bin/desktop-launch]
    plugs:
       gtk-3-themes:
          interface: content
          target: $SNAP/share/themes
          default-provider: gtk-common-themes
       icon-themes:
          interface: content
          target: $SNAP/share/icons
          default-provider: gtk-common-themes
       sound-themes:
       interface: content
       target: $SNAP/share/sounds
       default-provider: gtk-common-themes
    
    plugs: [home, unity7,  opengl, network, removable-media, optical-drive ,desktop, desktop-legacy, gsettings, x11, wayland]
     
parts:
  photonotebook:
    plugin: dump
    source: ./photonotebook/
    stage-packages: [libgif7, libx11-6, libxext6, libxi6, libxrender1, libxtst6, libasound2, libjpeg8, liblcms2-2, libfreetype6, libpng16-16, libcanberra-gtk-module, libcanberra-gtk3-module, fontconfig-config, fonts-liberation,
ttf-dejavu-core, ttf-ubuntu-font-family,libgtk-3-0, adwaita-icon-theme-full, gnome-icon-theme, hicolor-icon-theme, gtk2-engines-pixbuf]

  desktop-gtk3:
    source: https://github.com/ubuntu/snapcraft-desktop-helpers.git
    source-type: git
    source-subdir: gtk
    plugin: make
    make-parameters: ["FLAVOR=gtk3"]
    build-packages:
      - libgtk-3-dev
    stage-packages:
      - libxkbcommon0  # XKB_CONFIG_ROOT
      - ttf-ubuntu-font-family
      - dmz-cursor-theme
      - light-themes
      - adwaita-icon-theme
      - gnome-themes-standard
      - shared-mime-info
      - libgtk-3-0
      - libgdk-pixbuf2.0-0
      - libglib2.0-bin
      - libgtk-3-bin
      - unity-gtk3-module
      - libappindicator3-1
      - locales-all
      - xdg-user-dirs
      - ibus-gtk3
      - libibus-1.0-5
 

many thanks
Alan

Great, yeah I’m not surprised it’s bigger. Using the extension, your snap would have been utilizing libs from a “content snap”. That’s the part that isn’t ready yet for core20. So you are now bundling all those libs in your snap.

Hi Ken,
I see - Thanks!
I’ll be tweaking my yaml file to see if I can simplify it! Please do let me know when the extension is ready!

Cheers
Alan

1 Like

Jumped in just to second the need for a GNOME extension for core 20. Embedding GTK and using LZO compression can make Snap sizes grow a lot!

5 Likes