Gdk-pixbuf-query-loaders fails with "version `GLIBC_2.28' not found" error

For building the cmake snap, I use the snapcraft remote-build feature so I can cover all platforms fairly easily. This has been working fine for quite a few releases now and it continues to work. However, today I was running snapcraft from a new machine running Ubuntu 20 (previously ran it from an Ubuntu 18 VM). The packages all got generated fine and looked normal. But when I ran the cmake-gui app to test the packages, I saw an error on the terminal that I hadn’t seen before:

/snap/cmake/912/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders: /snap/core18/current/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by /lib/x86_64-linux-gnu/libglib-2.0.so.0)
ERROR: /snap/cmake/912/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders exited abnormally with status 1

It isn’t fatal, the app continues anyway, but I’d like to understand the cause and address the reason behind it if possible. Does anyone know what’s going on with this?

For reference, you can see the repo that produces the CMake snap here:

The doRelease.sh script in that directory is what I use to produce the packages. It’s not perfect, but it has been getting the job done. The configuration currently uses core18 as its base. I will probably update it to use core20 in the coming months, but I didn’t have time to adequately explore and test it for this release.

I’d managed to remove it from a local build on Ubuntu 20.04 by removing the cleanup part of your build file (note, I’d also built it with snapcraft --use-lxd locally, without the doRelease.sh). The relative filesize of the snap seemed comparable, so it doesn’t appear to be saving much.

Not so sure what exact behaviour is going on that causes the problem but hopefully it helps. Likely, there’s some interaction with $LD_LIBRARY_PATH whether set by desktop-launch or otherwise that means that different versions of GLibc are being pulled possibly from the host rather than the snap itself, but having never worked on classic snaps directly I’ll let the pro’s handle the rest.

It looks like the copy of gdk-pixbuf-query-loaders has picked up the copy of libglib-2.0.so.0 from the host system, which requires a newer version of libc.so.6 than the version from the base snap you’re using.

As classic snaps don’t default to running with LD_LIBRARY_PATH set, this probably means an rpath setting is missing on one of the files in the snap. It’s hard to say more without digging in further, but this might help point you in the right direction.

Thanks for your prompt replies and sorry for my silence! I only just got another chance to look at this today. Interestingly, it looks like this issue may have been fixed, most likely due to an update in the core snap or in snapcraft. I discovered today that the error doesn’t seem to be there any more with the latest snap. I’ve removed the cleanup stage nonetheless, since it wasn’t giving much benefit and has the potential to cause problems like this one.