AppImage created with Qt and linuxdeployqt with gtk3 plugin does not start on Gnome 4

Viewed 216

I created a Linux application in Qt 5.15.2 and packaged it to AppImage with linuxdeployqt. I do this on Ubuntu 18.04 virtual machine. The created AppImage runs without any problem on any Linux distributions which I have tried so far. Except Fedora 34 and Ubuntu 21.10, both with Gnome 4. The problem is obviously connected with Gnome 4 and it will probably bother many developers as Gnome 4 will be becoming more prevalent in the near future. But I have not yet found any satisfactory solution...

When I try to run my app from terminal on any Gnome 4 based distro, it shows this error:

./MyApp.AppImage 
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.

(MyApp.AppImage:2747): GLib-GIO-ERROR **: 08:56:35.632: Settings schema 'org.gnome.settings-daemon.plugins.xsettings' does not contain a key named 'antialiasing'

By trial and error, I found that this happens only if I add plugin platformthemes/libqgtk3.so when deploying AppImage with linuxdeployqt. If I do not bundle this library, then the final AppImage runs well with Gnome 4. But on the other hand, without this GTK3 plugin the application does not look good (theme, colors, icons, etc.) on al Gnome 3 and 4 based distros.

I googled for the root cause and a possible solution to this error and the most informative thing I found was this: https://bugs.launchpad.net/ubuntu/+source/gtk+3.0/+bug/1922464

So it seems that there is some clash with old GTK version (older than 3.24.26) and new Gnome 4. So I assume the same problem will we with all Gnome 40 based distros. I build and deploy my app with linuxdeployqt on Ubuntu 18.04 (virtual) machine, which has GTK 3.22.30, which is too old. The solution probably would be do compile and deploy my app on a newer version of Ubuntu. But the problem is that linuxdeployqt does not allow deploying AppImages with newer version than the OLDEST supported LTS version of Ubuntu.

I am unfortunately not a Linux expert, I have been always developing for Windows and started working partly on Linux some two years ago. So I am not sure what my options are.

A) Is it possible to install somehow newer GTK version on Ubuntu 18.04?

B) Is it possible to force somehow linuxdeployqt to work on newer Ubuntu?

C) Should I give up and create two versions of AppImages, one with libqgtk3.so plugin present (which will work everywhere except Gnome40-based distros) and the other AppImage without this plugin, which will work on Gnome40-based distros?

D) Any other way?

Regarding A and B: I am not sure if it is possible, how to do it and I would be worried about backward compatibility when run on for example Ubuntu 18.04, i.e. the oldest LTE.

Regarding C: Seems viable but it breaks the magic of one universal AppImages which should work everywhere... And another problem is that for example on Ubuntu 21.10 the application looks ugly without this GTK3 plugin...

Regarding D: is there any D at all?

0 Answers
Related