Snap to test Gtk3 - `GLIBC_2.25' not found

In an attempt to isolate my problems with snaps, I’ve made a snap just to test a helloworld program with python3 and Gtk3 on wayland.
The program only opens a window. I get this when running the snap:

/snap/hellowayland/x1/usr/lib/x86_64-linux-gnu/libgtk-3-0/gtk-query-immodules-3.0: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.25' not found (required by /snap/hellowayland/x1/lib/x86_64-linux-gnu/libsystemd.so.0)
python3: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.25' not found (required by python3)

my snap file:

name: hellowayland
version: 'master'
summary: Test python3 with gtk3 in a snap on wayland
description: |
  This snap tests a helloworld program written in python3 and Gtk3 on Wayland
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots

apps:
  hellowayland:
    command: desktop-launch $SNAP/bin/hellowayland
    plugs: [x11, unity7, wayland, desktop]

parts:
  hellowayland:
    source: .
    # See 'snapcraft plugins'
    plugin: python
    stage-packages:
      - python3-gi
      - libcanberra-gtk3-module
      - gir1.2-gtk-3.0
    after: [desktop-gtk3]

full source is here: https://github.com/lapisdecor/hellowayland

What dependencies am I missing? I tried putting libc6 on stage-packages but snapcraft gives-me a permission error when building:

PermissionError: [Errno 1] Operation not permitted: '/home/luis/Programar/hellowayland/hellowayland/parts/hellowayland/install/lib64/ld-linux-x86-64.so.2

Use ‘snapcraft cleanbuild’

I did and it built with libc6, but now I’ve got good old segfault:

$ hellowayland 
Falha de segmentação (imagem do núcleo gravada)

$ dmesg | grep segfault
[28038.616729] python3[4046]: segfault at 0 ip 00007f6c5e6c5dd6 sp 00007ffc67477790 error 4 in libwayland-client.so.0.3.0[7f6c5e6c0000+c000]

I’m new here and still finding my way around snapcraft, but I ran into a similar problem the other day: I was getting the exact same error message, and I also tried adding libc6 (in stage-packages, I believe) to no avail.
I was trying to build from 17.10 and eventually found my way to this post: https://forum.snapcraft.io/t/troubles-with-running-iproute2-inside-a-snap/2987. The solution that worked for me was to build from 16.04 instead of 17.10. It’s also possible to use lxd within 17.10 (I think using “cleanbuild” led you down this route), but I wasn’t ready to make my life quite that complicated.

I’m already building on xenial but thank you because what you said adds more info to this question. My main problem is now the segfault I have no idea if its a dependency problem or not. Are you also using python plugin and python3-gi ? I tried strace the snap but it’s way too much information for my limited knowledge of system calls. If someone has made a snap which uses python3 and Gtk3 and it’s working on wayland, please share the snapcraft.yaml file so I can compare it with my own.

If someone gets this same segfault and knows how to deal with it so it doesn’t happen please tell us.

If the same snap works in devmode but segfaults in strict confinement (jailmode) then it is likely to be seccomp killing your application. Use snappy-debug.security scanlog in a second terminal to monitor while you reproduce the segfault. If I’m right then the log in that second terminal will have one or more DENIED messages of which the last one will be whatever killed the program. This is most often a case of something using chown.

It’s not working in devmode. (the segfault only happens on wayland)

First thing I see that is going to cause issues is that you’re still bundling a second copy of libc6. Including libc in your snap should rarely be done, if ever, because the core snap should provide that and using your own version will cause issues.

ok, I’ve narrowed down the segfault, which appears to be occurring in libwayland-client.so: but I can’t figure out what’s causing the problem just yet. On a wayland system it is worth trying the test outside of a snap package just to confirm that it works at all (there might be a problem with wayland and python interacting badly with gtk3). The segfault is shown in /var/log/syslog as:

Dec  8 15:21:12 daniel-Z170X-UD5-TH kernel: [585764.184215] python3[1376]: segfault at 0 ip 00007fd78bdc1dd6 sp 00007ffe02866d70 error 4 in libwayland-client.so.0.3.0[7fd78bdbc000+c000]

There’s definitely no denials from seccomp or apparmor, so this is entirely within the domain of python and the libraries it calls. Hopefully it’s just a missing dependency in the snapcraft.yaml but I’m at a loss to say which one is required :frowning:

ok, with the help of @kenvandine we’ve figured-out that using the gnome-3-26 PPA for the dependencies fixes things up to work. The current theory is that libwayland from xenial has issues when running against more recent releases, which is causing your snap to fail hard. If you can, I’d recommend using the PPA for your snap for now.

If you’re using cleanbuild or the build service it’s difficult but you can try with a new part which your application builds after:

parts:
  gnome-3-26:
    before: [desktop-gtk3]
    plugin: nil
    prepare: |
      add-apt-repository -y ppa:ubuntu-desktop/gnome-3-26
      apt-get update && apt-get upgrade

  your-part:
    after: [gnome-3-26, desktop-gtk3]
    plugin: python
    ....

Alternatively you can add the repository to your host system if you’re building locally rather than in LXD:

sudo add-apt-repository ppa:ubuntu-desktop/gnome-3-26

I get this while trying to build:

Issue while loading part: properties failed to load for gnome-3-26: Additional properties are not allowed ('before' was unexpected)

1 Like

are you sure it isn’t after instead of before?

possibly - I thought before existed, I guess I was mistaken. Just remove that line entirely then. I was hoping to ensure it happened as the very first part.

I’m already making a build with after on that line, I will let it finish and try to test it, but I will erase the line from the code and try again later (builds on my system take forever). Before I do: don’t I have to include any new plug?

no, you don’t need any additional plugs. I guess you’re thinking about the gnome-platform shared snap, but you’re not using that in favour of including just the few dependencies in your snap directly. Technically you’re using the same binaries as the gnome-platform snap does so you could if you wanted move to using that, but it might be overkill for your needs. This way should get you going for now, at least.

Thank you, I will let you know how things went after testing.

The build aborted:

Parts ‘desktop-gtk3’ and ‘hellowayland’ have the following file paths in common which have different contents:
usr/bin/broadwayd
usr/bin/gtk-builder-tool
usr/bin/gtk-launch
usr/bin/update-mime-database.real
usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-ani.so
usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-bmp.so
usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-gif.so

how do I solve this issue? I know I have to use something to choose the files, but I don’t know which command or which files to choose.

Yeah, that’s what I was afraid of, and attempted to preempt with before: [desktop-gtk3]. The issue here is that desktop-gtk3 is installed first, a snapshot of the libraries taken, and then the gnome-3-26 runs and replaces those libraries with updated versions from the PPA which are different, so when those second set of files are snapshotted they are different to the first set and so snapcraft moans. First step is to try removing the after: [desktop-gtk3] you added to the gnome-3-26 part and try rebuilding. If that doesn’t work it’s going to be more complicated to try to resolve.

Basically you need the PPA to be available before the desktop-gtk3 part runs but that’s a cloud part which means you can’t specify directly for it to run after your PPA adding part. It’s therefore a bit undefined which will get built first, the desktop-gtk3 or the gnome-3-26, so you just have to hope it gets it right. The alternative is to create an LXD container or VM to build the snap and ensure the PPA is added before you start snapcraft.

It doesn’t gets it right after deleting the line. Same error. The second option could work but it requires me to abandon automatic builds on snapcraft.io since there I can’t add the PPA before starting snapcraft. Then it’s a problem since new builds will be made with every commit without the PPA. I really want to solve this with the first method so that it also works with snapcraft.io builds. If I could ditch desktop-gtk3 I wouldn’t have this error but I can’t since it’s needed for the desktop-launch command and probably some other dependencies…