project-slippi / Ishiiruka

GNU General Public License v2.0
330 stars 141 forks source link

AppImage fails to open in Fedora 35 (or any glib > 2.68) due to gmodule symbol lookup error #323

Closed Hnasar closed 2 years ago

Hnasar commented 3 years ago

The "Play" button from the Slippi Launcher Appimage didn't do anything, and it just crashes:

$ /home/h/.config/Slippi\ Launcher/netplay/Slippi_Online-x86_64.AppImage 
/tmp/.mount_SlippifOBEDG/AppRun.wrapped: symbol lookup error: /lib64/libgio-2.0.so.0: undefined symbol: g_module_open_full

(This was initially reported here https://github.com/project-slippi/slippi-launcher/issues/239 but the issue is in Ishiiruka)

Steps to Reproduce

  1. Install Fedora 35 or any newer Linux system
  2. Install the AppImage
  3. Note that you can't run the customized Dolphin

Workaround

LD_PRELOAD=/lib64/libgmodule-2.0.so ~/.config/Slippi\ Launcher/netplay/Slippi_Online-x86_64.AppImage

TLDR

Basically: libgio is taken from the host filesystem, and since GNOME 41 / glib version 2.70, gio depends on the g_module_open_full API added to gmodule in 2.70 (https://gitlab.gnome.org/GNOME/glib/-/commit/e74c955335921bd2e011c14723062bfd7cf4cc37).

So we need to match libgio and libgmodule. Either both from the host system, or neither from the host system.

Investigation

following AppImage troubleshooting (https://appimage-builder.readthedocs.io/en/latest/advanced/troubleshooting.html#missing-libraries), I used LD_DEBUG=all and compared the logs with and without the LD_PRELOAD.

It became apparent that in the broken case, these shared libraries are loaded from the host filesystem instead of the AppImage:

     libgobject
     libglib
     libgdk_pixbuf
     libgio

I then explored the AppImage filesystem with:

~/.config/Slippi\ Launcher/netplay/Slippi_Online-x86_64.AppImage --appimage-mount

and explored which shared libraries were needed, and which were bundled:

h@hes:/tmp/.mount_SlippiKbx5zV $ ldd AppRun.wrapped | grep gio
    libgio-2.0.so.0 => /lib64/libgio-2.0.so.0 (0x00007f8bbfb56000)
h@hes:/tmp/.mount_SlippiKbx5zV $ ls usr/lib | grep libgio
h@hes:/tmp/.mount_SlippiKbx5zV $ ls usr/lib | grep libgmod
libgmodule-2.0.so.0

I looked into how the AppImage is built to see if there was a manual list of libraries to include, but the incorrect behavior is already automated away (https://github.com/project-slippi/Ishiiruka/blob/slippi/build-appimage.sh#L49-L53).

Proposed solution

There's an open issue filed for linuxdeploy to exclude certain libraries (e.g. we could use it to exclude libgmodule), and there are some workarounds listed. https://github.com/linuxdeploy/linuxdeploy/issues/29

As you can see in that ticket, apparently AppImage always excludes libgio https://docs.appimage.org/introduction/concepts.html#do-not-depend-on-system-provided-resources.

And the AppImage github action (https://github.com/project-slippi/slippi-launcher/blob/main/.github/workflows/build.yml#L17) uses "ubuntu-latest" which is ubuntu 20.04 (https://github.com/actions/virtual-environments#available-environments), but even newer versions of Ubuntu don't have a new enough gmodule. https://packages.ubuntu.com/search?keywords=glib2.0

At least on my Fedora 35 system, libgmodule is the only library included in the AppImage which is a part of glib:

$ for f in `ls usr/lib`; do if [ -f /lib64/$f ] && rpm -q --whatprovides /lib64/$f | grep -q glib2 ; then echo $f; fi; done
libgmodule-2.0.so.0

So I think the safest way to address this issue is to require that systems have their distro's glib2 package installed, then we can remove libgmodule from the AppImage.

lcgamboa commented 2 years ago

I had the same problem due to the libgmodule library. The option to use LD_PRELOAD works but is not interesting for novice users. I solved the problem temporarily by extracting the AppImage files created with linuxdeploy, removing the libgmodule library and repackaging with appimagetool.

./my_file.AppImage --appimage-extract
rm -rf squashfs-root/usr/lib/libgmodule*
appimagetool-x86_64.AppImage -v squashfs-root
rm -rf squashfs-root/

It's not ideal, but it works as long as the option to remove libraries from the command line is not implemented.

NikhilNarayana commented 2 years ago

If you have a chance, please try this appimage and let me know if it works.

https://github.com/project-slippi/Ishiiruka/suites/4587443420/artifacts/123670174

dhalucario commented 2 years ago

If you have a chance, please try this appimage and let me know if it works.

https://github.com/project-slippi/Ishiiruka/suites/4587443420/artifacts/123670174

@NikhilNarayana Hey, I tried the AppImage file because I am stuck with the same problem here. It does not work, I get the same error.

/tmp/.mount_SlippiDJ6AYa/AppRun.wrapped: symbol lookup error: /lib64/libgio-2.0.so.0: undefined symbol: g_module_open_full
NikhilNarayana commented 2 years ago

Ok, attempt two https://github.com/project-slippi/Ishiiruka/suites/4807077632/artifacts/135081598. hopefully this does what I want.

dhalucario commented 2 years ago

It presents a different error now. @NikhilNarayana Is this related to libadwaita by any chance?


(AppRun.wrapped:20312): GdkPixbuf-WARNING **: 16:32:07.263: Cannot open pixbuf loader module file '/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache': No such file or directory

This likely means that your installation is broken.
Try running the command
  gdk-pixbuf-query-loaders > /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache
to make things work again for the time being.
Gtk-Message: 16:32:07.288: Failed to load module "canberra-gtk-module"
Gtk-Message: 16:32:07.288: Failed to load module "pk-gtk-module"
Gtk-Message: 16:32:07.289: Failed to load module "canberra-gtk-module"
Gtk-Message: 16:32:07.289: Failed to load module "pk-gtk-module"

(AppRun.wrapped:20312): GdkPixbuf-WARNING **: 16:32:07.417: Cannot open pixbuf loader module file '/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache': No such file or directory

This likely means that your installation is broken.
Try running the command
  gdk-pixbuf-query-loaders > /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache
to make things work again for the time being.

(AppRun.wrapped:20312): Gtk-WARNING **: 16:32:07.417: Could not load a pixbuf from icon theme.
This may indicate that pixbuf loaders or the mime database could not be found.

(AppRun.wrapped:20312): GdkPixbuf-WARNING **: 16:32:07.417: Cannot open pixbuf loader module file '/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache': No such file or directory

This likely means that your installation is broken.
Try running the command
  gdk-pixbuf-query-loaders > /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache
to make things work again for the time being.
**
Gtk:ERROR:../../../../gtk/gtkiconhelper.c:494:ensure_surface_for_gicon: assertion failed (error == NULL): Failed to load /usr/share/icons/Adwaita/16x16/status/image-missing.png: Unrecognized image file format (gdk-pixbuf-error-quark, 3)
Bail out! Gtk:ERROR:../../../../gtk/gtkiconhelper.c:494:ensure_surface_for_gicon: assertion failed (error == NULL): Failed to load /usr/share/icons/Adwaita/16x16/status/image-missing.png: Unrecognized image file format (gdk-pixbuf-error-quark, 3)
[1]    20312 IOT instruction (core dumped)  ./Slippi_Online-x86_64.AppImage
``
NikhilNarayana commented 2 years ago

I've went ahead and fixed this in place on v2.3.3 cause i'm not gonna wait for the upstream folks to fix it.

If you use the Launcher, run rm -rf "~/.config/Slippi Launcher/{netplay,playback,temp}" to clear out your old stuff and then re launch the Launcher to download the fixed versions.

dhalucario commented 2 years ago

Alright I will give that a shot.

dhalucario commented 2 years ago

Worked fine for me.

raleighlittles commented 2 years ago

It's been over a year -- is there any progress updates on this issue? 😢

I'm having the same problem on Ubuntu 22.04, when trying to open the PulseView/Sigrok AppImage:

pulseview: /tmp/.mount_PulseVk37JhR/usr/lib/libselinux.so.1: no version information available (required by /lib/x86_64-linux-gnu/libgio-2.0.so.0)
pulseview: /tmp/.mount_PulseVk37JhR/usr/lib/libselinux.so.1: no version information available (required by /lib/x86_64-linux-gnu/libmount.so.1)
pulseview: symbol lookup error: /lib/x86_64-linux-gnu/libgio-2.0.so.0: undefined symbol: g_module_open_full