I’m packaging a GTK based application using linuxdeploy on an Ubuntu 18.04 VirtualBox environment. The resulting AppImage runs on Ubuntu 20.10, but all the svg icons are broken. This appears to be because the runtime pixbuf loaders are being picked up from the host and aren’t compatible with some of the AppImage bundled libraries (cairo in particular, with a missing cairo_font_options_get_variations symbol), causing them to fail to load.
This page https://docs.appimage.org/packaging-guide/manual.html describes how to manually package GTK2 dependencies. I modified this somewhat for GTK3 (I don’t think theme engines are applicable in my case). The part that is confusing to me is the last section on that page, which says that several run-time variables must be set before running the AppImage, to ensure the AppImage versions of libraries get used. Is there a way to include this in the AppImage itself? I guess I would have to make a shell script in the AppImage to set them and then run my executable?
For testing purposes, I mounted the AppImage with --appimage-mount and set up the runtime variables, but when I ran the application it crashed. A quick gdb session and backtrace showed libgdk_pixbuf-2.0.so.0 was being used from the host system. This appears to be blacklisted by linuxdeploy. I copied the libraries from Ubuntu 18.04 to a temporary directory and added it to LD_LIBRARY_PATH. This still failed to load the pixbuf loaders though, since it was still picking up the host librsvg. I added the path to the AppImage /usr/lib to LD_LIBRARY_PATH, ran it again and it worked!
So in summary:
- How to set environment variables before running executable to override pixbuf loaders?
- Why is libgdk_pixbuf-2.0.so.0 blacklisted and what would be the consequence of including it?
- Why wasn’t librsvg picked up in the AppImage usr/lib directory? Is this because it is being runtime loaded and thus requires this path to be added to LD_LIBRARY_PATH?
Thanks for any tips on how I can best bundle my GTK application and get it working from Ubuntu 18.04 to current 20.10.