Crash on launch on sway/wayland
Platform: Arclinux, Mesa drivers. Sway 1.5, Qt 5.15, SDL 2.0.12
% ./run
INFO [py] launching openage v0.4.1-258-g1cd3f679
INFO [py] compiled by GNU 10.2.0
INFO [py] running in DEVMODE
INFO [py] No converted assets have been found
INFO launching engine with Path(Union(Directory(/home/user/openage/cfg).root @ (b'cfg',), Directory(/home/user/openage/assets).root @ (b'assets',)):) and fps limit 0
INFO SDL audio subsystems initialized
INFO Using audio device: default [freq=48000, format=32784, channels=2, samples=4096]
INFO Initialized SDL video subsystems.
INFO Compiled with Qt 5.15.0 and run with Qt 5.15.0
WARN QWindow::fromWinId(): platform plugin does not support foreign windows.
SIGSEGV
FATAL: terminate has been called
current stack:
Traceback (most recent call last):
File ?, in __libc_start_main+0xf2 [0x7f2e12414152]
File ?, in ? [0x55dfecad2752]
File ?, in ? [0x55dfecad25a4]
File ?, in PyModule_ExecDef+0x78 [0x7f2e12f13418]
File ?, in ? [0x55dfecad1c15]
File ?, in ? [0x55dfecad1249]
File ?, in ? [0x55dfecad0f90]
File ?, in _PyEval_EvalFrameDefault+0x4cb7 [0x7f2e12e66097]
File ?, in _PyFunction_Vectorcall+0x108 [0x7f2e12e72138]
File ?, in _PyEval_EvalFrameDefault+0x4be4 [0x7f2e12e65fc4]
File ?, in _PyObject_MakeTpCall+0x464 [0x7f2e12e6abf4]
File ?, in PyCFunction_Call+0x7e [0x7f2e12e780ce]
File ?, in ? [0x7f2dea03edae]
File ?, in ? [0x7f2dea03e3dc]
File ?, in openage::run_game(openage::main_arguments const&)+0x16f [0x7f2e12a7feff]
File ?, in openage::Engine::Engine(openage::util::Path const&, int, bool, char const*)+0x1137 [0x7f2e12a71b27]
File ?, in openage::gui::GUI::GUI(SDL_Window*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, openage::gui::EngineQMLInfo*)+0x92 [0x7f2e12b64192]
File ?, in qtsdl::GuiRenderer::GuiRenderer(SDL_Window*)+0x24 [0x7f2e12b696a4]
File ?, in qtsdl::GuiRendererImpl::GuiRendererImpl(SDL_Window*)+0x56 [0x7f2e12b6d6e6]
File ?, in qtsdl::GuiRenderingSetupRoutines::GuiRenderingSetupRoutines(SDL_Window*)+0x43 [0x7f2e12b6e043]
File ?, in qtsdl::GuiUniqueRenderingContext::GuiUniqueRenderingContext(SDL_Window*)+0x100 [0x7f2e12b6a4f0]
File ?, in QWindow::setSurfaceType(QSurface::SurfaceType) [0x7f2e10d39680]
File ?, in ? [0x7f2e124296a0]
File ?, in ? [0x7f2e12b79441]
File ?, in ? [0x7f2e127b7e07]
File ?, in ? [0x7f2e127b7d9a]
File ?, in openage::error::terminate_handler()+0xf5 [0x7f2e12b79635]
handing over to the system...
terminate called without an active exception
zsh: abort (core dumped) ./run
I have the following environment variables set (it doesn't crash at the same place when I unset them):
SDL_VIDEODRIVER=wayland
QT_QPA_PLATFORM=wayland-egl
The log is slightly different when only the SDL environment variable is set, otherwise it is as above with both or only the QT one:
INFO [py] launching openage v0.4.1-258-g1cd3f679
INFO [py] compiled by GNU 10.2.0
INFO [py] running in DEVMODE
INFO [py] No converted assets have been found
INFO launching engine with Path(Union(Directory(/home/user/openage/cfg).root @ (b'cfg',), Directory(/home/user/openage/assets).root @ (b'assets',)):) and fps limit 0
INFO SDL audio subsystems initialized
INFO Using audio device: default [freq=48000, format=32784, channels=2, samples=4096]
INFO Initialized SDL video subsystems.
INFO Compiled with Qt 5.15.0 and run with Qt 5.15.0
WARN QGLXContext: No GLXContext given
INFO Falling back to separate render context for GUI
WARN QGLXContext: No GLXContext given
SIGSEGV
FATAL: terminate has been called
uncaught exception
std::exception of type qtsdl::CtxExtractionException: adding GUI to the main rendering context failed
current stack:
Traceback (most recent call last):
File ?, in __libc_start_main+0xf2 [0x7f86d75b8152]
File ?, in ? [0x56361f8d1752]
File ?, in ? [0x56361f8d15a4]
File ?, in PyModule_ExecDef+0x78 [0x7f86d80b7418]
File ?, in ? [0x56361f8d0c15]
File ?, in ? [0x56361f8d0249]
File ?, in ? [0x56361f8cff90]
File ?, in _PyEval_EvalFrameDefault+0x4cb7 [0x7f86d800a097]
File ?, in _PyFunction_Vectorcall+0x108 [0x7f86d8016138]
File ?, in _PyEval_EvalFrameDefault+0x4be4 [0x7f86d8009fc4]
File ?, in _PyObject_MakeTpCall+0x464 [0x7f86d800ebf4]
File ?, in PyCFunction_Call+0x7e [0x7f86d801c0ce]
File ?, in ? [0x7f86af1e2dae]
File ?, in ? [0x7f86af1e23dc]
File ?, in openage::run_game(openage::main_arguments const&)+0x16f [0x7f86d7c23eff]
File ?, in openage::Engine::Engine(openage::util::Path const&, int, bool, char const*)+0x1137 [0x7f86d7c15b27]
File ?, in openage::gui::GUI::GUI(SDL_Window*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, openage::gui::EngineQMLInfo*)+0x92 [0x7f86d7d08192]
File ?, in qtsdl::GuiRenderer::GuiRenderer(SDL_Window*)+0x24 [0x7f86d7d0d6a4]
File ?, in qtsdl::GuiRendererImpl::GuiRendererImpl(SDL_Window*)+0x56 [0x7f86d7d116e6]
File ?, in ? [0x7f86d7bd9f01]
File ?, in qtsdl::GuiSeparateRenderingContext::GuiSeparateRenderingContext(SDL_Window*)+0x27f [0x7f86d7d0e7cf]
File ?, in ? [0x7f86d6916812]
File ?, in ? [0x7f86d6915f7a]
File ?, in ? [0x7f86d6915914]
File ?, in XQueryExtension+0x37 [0x7f86d5135387]
File ?, in ? [0x7f86d75cd6a0]
File ?, in ? [0x7f86d7d1d441]
File ?, in ? [0x7f86d795be07]
File ?, in ? [0x7f86d795bd9a]
File ?, in openage::error::terminate_handler()+0xf5 [0x7f86d7d1d635]
handing over to the system...
I think our rendering context extraction relies on X11, so we'd need a wayland path there to not use GLX, but whatever wayland provides us for that. This context then has to be shared by sdl and our Qt GUI. Feel free to implement :)
Wayland provides EGL (also EGL can be these days used on X11 well).
Wayland also provides x11 compatibility. Wayland is still betaware (although it is my daily driver, sway). I personnally suggest not bothering, as anybody who is running wayland, also has quick access to an x11 powered UI. Come time to launch in a year or two, and we can talk about fixing wayland support. I am just somebody who has made a single contribution, so I am not in a position to make decisions, those are just my two cents.
The Qt-to-SDL handshake for the rendering was removed in https://github.com/SFTtech/openage/pull/1497 which should resolve all Wayland issues.