Loaders do not respect `LC_RPATH` when loading on MacOS
On MacOS, gdk_pixbuf_get_toplevel()
does not use LC_RPATH
that has been set in the executable to load the loaders. This means that loaders must be located at @executable_path/../lib
regardless of the actual LC_RPATH
that has been set.
This affects Gimp 2.99. Here is an example:
This is the generated path:
/Users/user/gtk/inst/lib/gimp/2.99/plug-ins/file-jpegxl/../lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-ani.so
Which according to the LC_RPATH
should be:
/Users/user/gtk/inst/lib/gimp/2.99/plug-ins/file-jpegxl/../../../../lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-ani.so
Here is the error message:
Application icon missing: /Users/user/gtk/inst/share/icons/hicolor/scalable/apps/gimp.svg (Unable to load image-loading module: /Users/user/gtk/inst/lib/gimp/2.99/plug-ins/file-jpegxl/../lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.so: dlopen(/Users/user/gtk/inst/lib/gimp/2.99/plug-ins/file-jpegxl/../lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.so, 0x0001): tried: '/Users/user/gtk/inst/lib/libpixbufloader-svg.so' (no such file), '/Users/user/gtk/inst/lib/gimp/2.99/plug-ins/file-jpegxl/../lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.so' (no such file))
Here is the result of checking the LC_RPATH
:
$ otool -l /Users/user/gimp299-osx-app/GIMP-2.99.app/Contents/Resources/lib/gimp/2.99/plug-ins/file-jpegxl/file-jpegxl
...
Load command 31
cmd LC_RPATH
cmdsize 48
path @executable_path/../../../../ (offset 12)