Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility when dynamically linking libappimageupdate in GTK app #211

Open
gholmann16 opened this issue Oct 15, 2022 · 10 comments
Open

Comments

@gholmann16
Copy link
Contributor

When I dynamically link to libappimageupdate, I face no error, but when I try to statically link to libappimageupdate.a, I get this warning:

(Neptune:49701): Gtk-WARNING **: 19:50:03.514: Could not load a pixbuf from icon theme.
This may indicate that pixbuf loaders or the mime database could not be found.

I cannot find any more specifics than this because I cannot remove the dependencies, which appimageupdate needs, but I have tried to see if other libraries are doing it and it seems to narrow down to libappimageupdate. I face the same problem both on Ubuntu and Arch Linux.

@TheAssassin
Copy link
Member

libappimageupdate does not use Gtk+, I can't imagine this is related to our project in any way. Also, static linking is not a recommended strategy.

@probonopd
Copy link
Member

@Seren541 can you post a link to the AppImage in question please? How do you create it? If it ships any Gtk platform plugin themes for Qt, then these should be removed, similar to #152.

@TheAssassin
Copy link
Member

This should then be discussed elsewhere. Also, it is unclear whether the application in question uses Qt at all.

@Ativerc
Copy link

Ativerc commented Oct 20, 2022

I think I have the same error.

My AppImageUpdate.AppImage has exec permissions but double-clicking it does nothing, so I tried launching it from the terminal and I get some GTK errors:

$ ./AppImageUpdate-x86_64.AppImage 
AppImageUpdate version 1-alpha (commit 20a6450), build 93 built on 2022-01-24 18:35:10 UTC

(AppRun.wrapped:32087): Gtk-WARNING **: 14:32:12.971: Could not load a pixbuf from icon theme.
This may indicate that pixbuf loaders or the mime database could not be found.
**
Gtk:ERROR:../../../../gtk/gtkiconhelper.c:494:ensure_surface_for_gicon: assertion failed (error == NULL): Failed to load /usr/share/icons/Yaru/16x16/status/image-missing.png: Fatal error reading PNG image file: bad parameters to zlib (gdk-pixbuf-error-quark, 0)
Bail out! Gtk:ERROR:../../../../gtk/gtkiconhelper.c:494:ensure_surface_for_gicon: assertion failed (error == NULL): Failed to load /usr/share/icons/Yaru/16x16/status/image-missing.png: Fatal error reading PNG image file: bad parameters to zlib (gdk-pixbuf-error-quark, 0)
Aborted (core dumped)

Running Ubuntu 20.04.5 LTS. Please let me know if I can add some more information.

Also, as an user of AppImages, I would prefer I could update AppImages, add .desktop files and icons from one single tool.

@gholmann16
Copy link
Contributor Author

@Seren541 can you post a link to the AppImage in question please? How do you create it? If it ships any Gtk platform plugin themes for Qt, then these should be removed, similar to #152.

The binary I am trying to build is this one: https://github.com/gholmann16/Neptune

It will be difficult to build in your system because I have not as of yet made a portable build system due to the fact that I cannot even build it on my own yet.

The issue is as follows. Gtk being available on most linux distros is leading me to dynamically link it. But libappimageupdate, being available nowhere is leading me to link it statically. When I make install and call the so file's functions, everything goes according to plan. But as soon as I statically link it (as well as all the dependencies generated by the makefile), it starts to have pixbuf issues, aka icons are not loading. I just tried it now roughly a year later and I get the exact same result. This is gtk3 for the record.

@gholmann16
Copy link
Contributor Author

After persuing the gerror returned this error is spammed:
Failed to load image “/home/gholm/.cache/neptune/apps/LBRY”: Fatal error in PNG image file: bad parameters to zlib
Failed to load image “/home/gholm/.cache/neptune/apps/Kdenlive”: Fatal error in PNG image file: bad parameters to zlib

I think this is because gtk is linked to libz and libzsync is using a custom libz which is thereby not loading the correct libz for gtk? When I try to get rid of the libzsync2_libz.a file I get errors because this custom static build has custom symbols not found in the shared library, so now I'm at a loss basically.

@probonopd
Copy link
Member

I had already fixed this once by

    # Make absolutely sure there are no Gtk plugins,
    # they created a LOT of hassle: #145 #149 #150 #151 #152 #161 #166
    # https://github.com/AppImage/AppImageUpdate/issues/150#issuecomment-674013820
    # https://github.com/AppImage/AppImageUpdate/pull/152/files
    # Apparently linuxdeploy puts them in and there is no apparent way to disable this
    # https://github.com/linuxdeploy/linuxdeploy-plugin-qt/issues/109
    # All of the following fail because... Docker?
    sudo apt-get remove qt5-gtk-platformtheme || true
    sudo apt-get remove qt5-xdgdesktopportal-platformtheme || true
    # Really desperate attempt now
    sudo find / -name 'libqgtk*.so' -delete || true
    sudo find / -name 'libqxdgdesktopportal.so' -delete || true

and in linuxdeploy/linuxdeploy-plugin-qt#109, so this sounds like a regression @TheAssassin?

@gholmann16
Copy link
Contributor Author

Your fix is to just remove gtk? My project is coded in gtk, not qt with gtk plugins so this is not really an option.

@probonopd
Copy link
Member

probonopd commented Aug 27, 2023

I was assuming that the problematic application is AppImageUpdate, which is a Qt application and not a Gtk application. The fix is to remove Gtk theming for Qt from the AppDir. The fix to that issue was what I was referring to; but I understand now that you are trying to link AppImageUpdate from a Gtk application. I have no clue about that, sorry.

It's probably not a good idea to link together Qt and Gtk in the same application anyway. So better just let the AppImageUpdate application handle the updating of your AppImage.

@probonopd probonopd changed the title Incompatibility with GTK Incompatibility when dynamically linking libappimageupdate in GTK app Aug 27, 2023
@gholmann16
Copy link
Contributor Author

For now I'll probably end up using the shared library as that works but I might end up going that route.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants