Closed fgaz closed 3 months ago
I've been able to run Principia with the native Wayland SDL video driver on my Arch system, but I just tested in a NixOS live environment and can reproduce the issue there. I ended up looking at the packaging for my system's GLEW package and saw that it has this patch applied for something with Wayland support, and rebuilding my GLEW package before this commit makes me able to reproduce the crash on Arch too. Seems like upstream GLEW knows about there being issues like this on Wayland: https://github.com/nigels-com/glew/issues/172
The workaround other projects seems to have done is just ignore the GLEW_ERROR_NO_GLX_DISPLAY
error and apparently it will just work like regularly on Wayland, as concerning as it may look. With my rebuilt GLEW without distro patches the following change to Principia makes the game work again:
diff --git a/src/tms/backend/main.cc b/src/tms/backend/main.cc
index 375a03d7..ca9ba0d9 100644
--- a/src/tms/backend/main.cc
+++ b/src/tms/backend/main.cc
@@ -400,7 +400,7 @@ tbackend_init_surface()
tms_infof("Initializing GLEW...");
GLenum err = glewInit();
- if (err != GLEW_OK) {
+ if (err != GLEW_OK && err != GLEW_ERROR_NO_GLX_DISPLAY) {
tms_infof("ERROR: %s", glewGetErrorString(err));
exit(1);
}
I wonder if this workaround would work under NixOS too.
Apparently the fix also fixes our AppImage builds that have previously been broken when trying with the Wayland video driver. So I assume this was it.
I confirm that applying the patch in https://github.com/Bithack/principia/issues/174#issuecomment-2197494069 fixes the issue for me
Principia version
2024.06.28, NixOS package
OS / Hardware
Summary
principia crashes when run under wayland (
SDL_VIDEODRIVER=wayland
). It works fine under X11 (SDL_VIDEODRIVER=x11
)Steps to reproduce
contents of run.log: