Snap issues with GTK

Hi guys,

I am trying to create a snap of anydesk and I am not able to start AnyDesk after building the snap.

sudo snap run anydesk

No UTF-8. Trying to change locale.
C.UTF-8: not available.
en_US.UTF-8: not available.
Couldn’t set the locale to UTF-8.

(process:2264): GdkPixbuf-WARNING **: 14:17:17.256: Cannot open pixbuf loader module file '/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache': No such file or directory

This likely means that your installation is broken.
Try running the command
  gdk-pixbuf-query-loaders > /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache
to make things work again for the time being.
terminate called after throwing an instance of 'base::gdk_exception_t'

This is my yml file :

name: anydesk # you probably want to 'snapcraft register <name>'
version: '2.9.5' # just for humans, typically '1.2+git' or '1.3.2'
summary: Single-line elevator pitch for your amazing snap # 79 char long summary
description: |
  This is my-snap's description. You have a paragraph or two to tell the
  most important story about your snap. Keep it under 100 words though,
  we live in tweetspace and your description wants to look good in the snap
  store.

grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots

parts:
  anydesk:
    plugin: dump
    source: https://download.anydesk.com/linux/anydesk_2.9.5-1_amd64.deb
    source-type: deb
    build-packages:
       - libgtk-3-dev
    stage-packages:
       - libc6
       - zlib1g
       - zlib1g-dev
       - libpng16-16
       - libpango1.0-0
       - libgvc6-plugins-gtk
       - libcanberra-gtk-module
       - libcanberra-gtk3-module
       - locales-all
       - 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
       - xdg-user-dirs
       - ibus-gtk3
       - libibus-1.0-5
apps:
  anydesk:
     command: anydesk
     plugs:
        - x11
        - network-bind

Thank you for your help!

You can fix this by using the snapcraft-desktop-helpers:

  • Add after: [desktop-gtk3] to your part
  • Add desktop-launch to the commandline
parts:
  anydesk:
    after: [desktop-gtk3]
    plugin: dump
    .... # the rest of the part definition

apps:
  anydesk:
    command: desktop-launch $SNAP/anydesk
    plugs:
    - x11
    - wayland # let it run on wayland, because it's gtk3 so it should be fine
    - desktop # needed for a lot of gtk3 and glib interaction with the host system
    - desktop-legacy # needed for accessibility tools IIRC
    - network-bind

This is what I am getting from adding desktop-gtk3 :

Skipping pull desktop-gtk3 (already ran)
Skipping build desktop-gtk3 (already ran)
Skipping stage desktop-gtk3 (already ran)
Skipping pull anydesk (already ran)
Skipping build anydesk (already ran)
Skipping stage anydesk (already ran)
Priming desktop-gtk3
The GLIBC version of the targeted core is 2.23. A newer libc will be required for the following files:

  • /home/user/snapcraft/AnyDesk/prime/lib/x86_64-linux-gnu/libexpat.so.1.6.7 (requires GLIBC 2.25)
  • /home/user/snapcraft/AnyDesk/prime/lib/x86_64-linux-gnu/libbsd.so.0.8.7 (requires GLIBC 2.25)
  • /home/jeff/snapcraft/AnyDesk/prime/usr/lib/x86_64-linux-gnu/libxshmfence.so.1.0.0 (requires GLIBC 2.27)
  • /home/jeff/snapcraft/AnyDesk/prime/usr/lib/x86_64-linux-gnu/libp11-kit.so.0.3.0 (requires GLIBC 2.26)
  • /home/jeff/snapcraft/AnyDesk/prime/usr/lib/x86_64-linux-gnu/libexpatw.so.1.6.7 (requires GLIBC 2.25)
  • /home/jeff/snapcraft/AnyDesk/prime/usr/lib/x86_64-linux-gnu/libgnutls.so.30.14.10 (requires GLIBC 2.25)
    ‘libc6’ is required inside the snap for this part to work properly.
    Add it as a stage-packages entry for this part.

Can you try this with snapcraft clean build?

should be snapcraft cleanbuild (one word)

2 Likes

I am getting the same error as I had at the beginning :frowning:

did you change your command to be command: desktop-launch $SNAP/anydesk ?

this should technically run the pixbuf loader on first start.

I did at first and I had an issue, I will try to see if it does it again and link to you guys :slight_smile:

EDIT

This is what I get when I build the snap.

Failed to generate snap metadata: The specified command 'desktop-launcher' defined in the app 'anydesk' does not exist or is not executable

That’s because it’s not called desktop-launcher. Re-read the instructions and try again :slight_smile:

Damn, I feel like an idiot now :blush:

Now I need to find anydesk lol …

/snap/anydesk/x1/bin/desktop-launch: line 463: /snap/anydesk/x1/anydesk: No such file or directory

probably in $SNAP/bin or $SNAP/usr/bin

Thank you! Thank you all for your help!