SasView/sasview

sasview release doesn't run on Wayland

Opened this issue · 7 comments

Describe the bug
When running the sasview executable in the tarball on Wayland, the following error will occur.

(sasview:60816): GLib-GIO-ERROR **: 14:09:00.546: Settings schema 'org.gnome.settings-daemon.plugins.xsettings' does not contain a key named 'antialiasing'
Trace/breakpoint trap (core dumped)

This error doesn't occur when running the executable under X11. I presume this is because the required dependencies to run the application on Wayland are not packaged.

SasView version (please complete the following information):

  • Version: 6.0.0-Beta2

Operating system (please complete the following information):

  • OS: ubuntu 22.04.4 LTS

Additional context

  • Gnome Version: 42.9

I can get sasview to start up under Wayland when working from a git checkout, so we can confirm that this is an issue with the pyinstaller bundle. (But as in #3075 perhaps just making wheels work is more important than making pyinstaller work...)

Starting point:

  • Minimal(ish) Debian 12 VM with weston/wayland installed and running
  • As well as the packages needed directly by sasview (from pip), I installed:
# apt install unzip libegl1 libopengl0 libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 libnss3 libxcomposite1 libxdamage1 libxtst6

(yes, that's a lot of X-specific libraries for something running under wayland; not sure if that's due to Qt supporting both; I don't think we have that list of packages documented anywhere other than CI.yml)

In this test harness, the current 6.0 installer image dies with a symbol error with libEGL_mesa.so.0; copying that particular library from the Ubuntu 20.04 package (libegl-mesa0_21.2.6-0ubuntu0.1~20.04.2_amd64.deb; the package from the Ubuntu release that the installer is built against) into the unpacked pyinstaller bundle fixes the error, indicating that this is yet another library that should be explicitly installed at pyinstaller time and then pyinstaller instructed to include it somehow.

$ wget http://security.ubuntu.com/ubuntu/pool/main/m/mesa/libegl-mesa0_21.2.6-0ubuntu0.1~20.04.2_amd64.deb
$ dpkg -x libegl-mesa0_21.2.6-0ubuntu0.1~20.04.2_amd64.deb libegl
$ cp libegl/usr/lib/x86_64-linux-gnu/libEGL_mesa.so.0 sasview/

That of course just uncovers the next error... which can be solved by unpacking python3-opengl into the unpacked pyinstaller bundle.

# apt install python3-opengl
$ cp -r /usr/lib/python3/dist-packages/OpenGL sasview/

Next steps:

  • figure out if including libegl-mesa0 and python3-opengl into the installer is always a good idea or if there are downsides to doing so
  • figure out how to get them to be included in the bundle; pyopengl has quite a lot of libraries that it uses, all of which presumably also need to be included

Thank you @llimeht for your reply.

I was able to follow your steps on Ubuntu 24 (running on a container using Distrobox ) to get sasview running. However, I still got the error I quoted in the original issue when running sasview on my host machine. I'm going to try to narrow down what could potentially be the problem.

@jamescrake-merani it seems that you are working on it. Can you please assign yourself to the issue?

I noticed that the org.gnome.settings-daemon.plugins.xsettings is actually a dbus configuration. When looking at it, I noticed the key antialiasing is missing on my host machine just like the error message specifies. However, on the containers where sasview did run on Wayland, the schema xsettings is not present at all. My suspicion is that this configuration is being looked up by a library that sasview depends on. Will investigate further tomorrow.

@jamescrake-merani well that's some progress at least 👍

The error message you have is from the gnome config system. I can replicate this on a Debian 12 VM by additionally apt install gnome-session mutter sddm and then logging into a GNOME Wayland session.

The error reports a mismatch in the keys that gsettings knows about between the newer settings on the host and the library inside the pyinstaller bundle would lead to this. Inspecting /usr/share/glib-2.0/schemas/org.gnome.settings-daemon.plugins.xsettings.gschema.xml between an old Ubuntu package and the newer Debian install shows that the antialiasing key has been deprecated.

The isolation of pyinstaller from the host system is far from perfect and this is a case where it fails. It's not obvious to me why an application built in Qt6 is talking to gsettings at all. There's a reasonable chance this is all a complete side show from something silly opening a Gtk library while figuring out that it should use Qt instead.

So... a workaround is to stop sasview from talking to gsettings by deleting out some environment variables that encourage something to do so. The following removes three environment variables and also forces Qt6 to use wayland. This is sufficient for me to get sasview running under a GNOME Wayland session:

env -u SESSION_MANAGER -u GNOME_DESKTOP_SESSION_ID -u XDG_CURRENT_DESKTOP QT_QPA_PLATFORM=wayland ./sasview

There are some other rough edges such as the "What's New" window appearing behind the main window so that the main window is unresponsive, but that's the next set of challenges.

@llimeht Thank you so much for your help on this issue. I'm curious as to whether the call to gsettings is happening within sasview itself, or one of its dependencies.

The following removes three environment variables and also forces Qt6 to use wayland. This is sufficient for me to get sasview running under a GNOME Wayland session:

Unfortunately this workaround does not appear to work on my machine. I am getting the same error message.

There are some other rough edges such as the "What's New" window appearing behind the main window so that the main window is unresponsive, but that's the next set of challenges.

I was having this issue even outside of the pyinstaller distribution but I think I've just managed to fix it. Seems to have been because the parent of the What's New widget is not set correctly. I'll submit a pull request today.