probonopd / go-appimage

Go implementation of AppImage tools
MIT License
818 stars 71 forks source link

appimagetool don't configure `loaders.cache` #284

Closed brunvonlope closed 4 months ago

brunvonlope commented 7 months ago

Similar to #282


When bundling GTK apps, appimagetool copy the loaders.cache file required by GdkPixbuf. But inside the file the paths aren't adapted to be relative to AppDir/usr/lib... which makes the system loaders be called by GdkPixbuf.

I suggest changing the paths inside the loaders.cache file when calling deploy in a similar way that we do manually with GIMP: https://gitlab.gnome.org/GNOME/gimp/-/blob/master/build/linux/appimage/bundle-gimp-appimage.sh?ref_type=heads#L170. Otherwise, some apps can even not display the GUI at all.

probonopd commented 7 months ago

Hello @brunvonlope, apparently you know a lot about the inner workings of GTK (well, at least compared to me, anyways). Would you be able to send a pull request? Thanks for your suggestion.

brunvonlope commented 7 months ago

Hello @brunvonlope, apparently you know a lot about the inner workings of GTK (well, at least compared to me, anyways). Would you be able to send a pull request? Thanks for your suggestion.

I know almost nothing, specially about Go ☹️. To be fair, this bug was discovered by accident while using testing AppImage in some distros.

probonopd commented 7 months ago

We already have some code related to it:

https://github.com/probonopd/go-appimage/blob/6866993bd2a1b8b182a5f27d9f913dbd5c7aec45/src/appimagetool/appdirtool.go#L625-L675

Maybe it is not working properly?

pbs3141 commented 4 months ago

Indeed it's not working:

ERROR whatToPatchAway: could not find directory that contains libpixbufloader-png.so

My system doesn't even have a libpixbufloader-png.so anymore. PNG support is baked into gdk-pixbuf itself, not implemented as a loader module.

This could either be fixed by assuming the following directory layout

loaders.cache
loaders/
    *.so

so that the loaders can be found from the location of loaders.cache, or searching other formats, e.g. svg, webp, until one succeeds.

probonopd commented 4 months ago

Thanks @pbs3141. I'd appreciate code contributions from someone knowledgeable about Gtk here.

Has https://github.com/linuxdeploy/linuxdeploy-plugin-gtk/blob/3b67a1d1c1b0c8268f57f2bce40fe2d33d409cea/linuxdeploy-plugin-gtk.sh#L312-L332 the correct logic?