Hello,

When running an application that uses gdk-pixbuf as a library, the GDK_PIXBUF_MODULE_FILE environment variable takes precedence over build-time defaults (see for example [1]).
If a Guix user on a foreign distro installs in their main profile an application that sets GDK_PIXBUF_MODULE_FILE, the variable will be used for all applications, not only the ones installed by Guix (because it's exported in the profile environment).

See for example when running Thunderbird on Debian when GDK_PIXBUF_MODULE_FILE is set in the main Guix profile environment file (note how it loads libgdk_pixbuf provided by Debian, but the PNG loader provided by Guix):
"""
$ strace thunderbird 2>&1 | grep -E '^open(at)?\(.*\.so' | grep pixbuf
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0", O_RDONLY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/gnu/store/5m25ni3hfvmqlsszvbkbz243avz78cb2-gdk-pixbuf-2.42.4/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.so", O_RDONLY|O_CLOEXEC) = 35
"""

This was not so much of a problem until the bump of gdk-pixbuf to version 2.42.8 (see commit 8b0565c07740167982e9cef3fc37359b25340d1b).

In gdkpixbuf 2.42.8, the support for PNG and JPEG is builtin (it's linked statically, and not as  shared libraries like it was the case in 2.42.4).
This also means that the shared libraries to be able to load such files are not generated nor install by Guix at all anymore.
Applications that use the newer version of gdk-pixbuf will have no issue as the gdk-pixbuf library already provides support for loading PNG files.
For non-Guix applications that have been linked against (or dlopen) a previous version however, this becomes problematic as the support for PNG files is not builtin anymore, so they will rely on loading the shared library for it by looking at GDK_PIXBUF_MODULE_FILE, which no longer contains the path to the lib for PNG files.

An example of such an application is Thunderbird when running on Debian: with gdk-pixbuf 2.42.8 installed in the main Guix profile, it crashes everytime the dialog to open a file is opened.  
There could be multiple ways to solve it:

- Make sure the library for PNG support (and JPEG) is built as a shared library again with the current gdk-pixbuf version. This would fix the crashing apps, but is arguably more a workaround than a solution (do we have any guarantee that the shared libraries are compatible with any gdk-pixbuf version the foreign distro might have?).
- Set the GDK_PIXBUF_MODULE_FILE variable for all Guix applications that need it, but do not export it for the whole profile. Since many other variables are similarly exported in the profile environment I imagine there is a good reason for it, so this might not be possible.
- Document as a limitation to not install applications that set GDK_PIXBUF_MODULE_FILE in the main profile on foreign distros.
- Does anyone have any other idea?

Note that as a temporary fix for anyone affected by this issue, another possiblity is to unset the GDK_PIXBUF_MODULE_FILE variable in a terminal before starting the affected application.

Kind regards,

Raphaël

[1]: https://developer-old.gnome.org/gtk4/stable/gtk-running.html#id-1.9.4.2.10