Background
The latest Fedora builds are using the Wayland display system instead of Xorg. This has been supported in SDL2 graphics library since around 2016 and then early this year, they enabled by default. This was then reverted just before SDL2 2.0.22 release because it was considered not ready yet with NVIDIA drivers. Fast forward to this week where SDL2 and NVIDIA now play nicely together with the release of open kernel driver version v515. In addition, my AMD integrated GPU with 4GB UMA memory works even better! As it is a laptop with hybrid graphics, I currently have a far greater number of issues with Xorg, than we do with Wayland.
Problem
Launching Factorio on the Weston compositor that is provided by the Wayland project results in the following:
Code: Select all
% ./bin/x64/factorio
0.000 2022-06-11 12:03:13; Factorio 1.1.59 (build 59719, linux64, full)
0.008 Operating system: Linux (Fedora)
0.008 Program arguments: "./bin/x64/factorio"
0.008 Read data path: /home/U/factorio/Space Exploration/data
0.008 Write data path: /home/U/factorio/Space Exploration [394105/404129MB]
0.008 Binaries path: /home/U/factorio/Space Exploration/bin
0.011 System info: [CPU: AMD Ryzen 7 5800H with Radeon Graphics, 16 cores, RAM: 60123 MB]
0.011 Environment: DISPLAY=<unset> WAYLAND_DISPLAY=wayland-1 DESKTOP_SESSION=<unset> XDG_SESSION_DESKTOP=<unset> XDG_CURRENT_DESKTOP=<unset> __GL_FSAA_MODE=<unset> __GL_LOG_MAX_ANISO=<unset>
__GL_SYNC_TO_VBLANK=<unset> __GL_SORT_FBCONFIGS=<unset> __GL_YIELD=<unset>
0.011 Display options: [FullScreen: 1] [VSync: 0] [UIScale: custom (125.0%)] [Native DPI: 1] [Screen: 255] [Special: lmw] [Lang: en]
Factorio crashed. Generating symbolized stacktrace, please wait ...
/tmp/factorio-build-Xa3JcI/src/Util/Logger.cpp (313): Logger::writeStacktrace(FileWriteStream*, StackTraceInfo*) [clone .constprop.0]
/tmp/factorio-build-Xa3JcI/src/Util/Logging.cpp (101): Logging::logAndAbortOrThrow(char const*, unsigned int, LogLevel, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<ch
ar> > const&) [clone .constprop.0]
/tmp/factorio-build-Xa3JcI/src/Util/Logging.cpp (93): Logging::logAndAbortOrThrow(char const*, unsigned int, LogLevel, char const*, ...) [clone .constprop.0]
/tmp/factorio-build-Xa3JcI/src/Graphics/SDLWindow.cpp (117): SDLWindow::SDLWindow(GraphicsInterface::Type, WindowPositionData) [clone .constprop.0]
/tmp/factorio-build-Xa3JcI/src/Graphics/SDLWindow.cpp (103): SDLWindow::SDLWindow(GraphicsInterface::Type, short, short, bool)
/tmp/factorio-build-Xa3JcI/src/GlobalContext.cpp (923): GlobalContext::loadGraphics(std::optional<WindowPositionData>) [clone .isra.0]
/tmp/factorio-build-Xa3JcI/src/GlobalContext.cpp (450): GlobalContext::init(bool, bool, bool, std::optional<WindowPositionData>) [clone .constprop.0] [clone .isra.0]
/tmp/factorio-build-Xa3JcI/src/MainLoop.cpp (272): MainLoop::run(Filesystem::Path const&, Filesystem::Path const&, bool, bool, std::function<void ()>, Filesystem::Path const&, MainLoop::HeavyMod
e)
/tmp/factorio-build-Xa3JcI/src/Main.cpp (1142): main
0x7fae3fa7d1e9
__libc_start_main
0x76195d
0xffffffffffffffff
Stack trace logging done
0.090 Error SDLWindow.cpp:117: SDL couldn't be initialized. SDL_Error: No available video device
Logger::writeStacktrace skipped.
0.090 Error Util.cpp:97: Unexpected error occurred. If you're running the latest version of the game you can help us solve the problem by posting the contents of the log file on the Factorio
forums.
Please also include the save file(s), any mods you may be using, and any steps you know of to reproduce the crash.
0.091 Error MessageDialog.cpp:53: Unable to show message dialog. SDL Error: [No message system available]
Code: Select all
% SDL_VIDEODRIVER=wayland ./bin/x64/factorio 2>&1
0.000 2022-06-11 12:05:13; Factorio 1.1.59 (build 59719, linux64, full)
0.007 Operating system: Linux (Fedora)
0.007 Program arguments: "./bin/x64/factorio"
0.007 Read data path: /home/U/factorio/Space Exploration/data
0.007 Write data path: /home/U/factorio/Space Exploration [394103/404127MB]
0.007 Binaries path: /home/U/factorio/Space Exploration/bin
0.011 System info: [CPU: AMD Ryzen 7 5800H with Radeon Graphics, 16 cores, RAM: 60123 MB]
0.011 Environment: DISPLAY=<unset> WAYLAND_DISPLAY=wayland-1 DESKTOP_SESSION=<unset> XDG_SESSION_DESKTOP=<unset> XDG_CURRENT_DESKTOP=<unset> __GL_FSAA_MODE=<unset> __GL_LOG_MAX_ANISO=<unset>
__GL_SYNC_TO_VBLANK=<unset> __GL_SORT_FBCONFIGS=<unset> __GL_YIELD=<unset>
0.011 Display options: [FullScreen: 1] [VSync: 0] [UIScale: custom (125.0%)] [Native DPI: 1] [Screen: 255] [Special: lmw] [Lang: en]
Factorio crashed. Generating symbolized stacktrace, please wait ...
/tmp/factorio-build-Xa3JcI/src/Util/Logger.cpp (313): Logger::writeStacktrace(FileWriteStream*, StackTraceInfo*) [clone .constprop.0]
/tmp/factorio-build-Xa3JcI/src/Util/Logging.cpp (101): Logging::logAndAbortOrThrow(char const*, unsigned int, LogLevel, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<ch
ar> > const&) [clone .constprop.0]
/tmp/factorio-build-Xa3JcI/src/Util/Logging.cpp (93): Logging::logAndAbortOrThrow(char const*, unsigned int, LogLevel, char const*, ...) [clone .constprop.0]
/tmp/factorio-build-Xa3JcI/src/Graphics/SDLWindow.cpp (117): SDLWindow::SDLWindow(GraphicsInterface::Type, WindowPositionData) [clone .constprop.0]
/tmp/factorio-build-Xa3JcI/src/Graphics/SDLWindow.cpp (103): SDLWindow::SDLWindow(GraphicsInterface::Type, short, short, bool)
/tmp/factorio-build-Xa3JcI/src/GlobalContext.cpp (923): GlobalContext::loadGraphics(std::optional<WindowPositionData>) [clone .isra.0]
/tmp/factorio-build-Xa3JcI/src/GlobalContext.cpp (450): GlobalContext::init(bool, bool, bool, std::optional<WindowPositionData>) [clone .constprop.0] [clone .isra.0]
/tmp/factorio-build-Xa3JcI/src/MainLoop.cpp (272): MainLoop::run(Filesystem::Path const&, Filesystem::Path const&, bool, bool, std::function<void ()>, Filesystem::Path const&, MainLoop::HeavyMod
e)
/tmp/factorio-build-Xa3JcI/src/Main.cpp (1142): main
0x7f9b39b021e9
__libc_start_main
0x76195d
0xffffffffffffffff
Stack trace logging done
0.088 Error SDLWindow.cpp:117: SDL couldn't be initialized. SDL_Error: wayland not available
Logger::writeStacktrace skipped.
0.088 Error Util.cpp:97: Unexpected error occurred. If you're running the latest version of the game you can help us solve the problem by posting the contents of the log file on the Factorio
forums.
Please also include the save file(s), any mods you may be using, and any steps you know of to reproduce the crash.
0.089 Error MessageDialog.cpp:53: Unable to show message dialog. SDL Error: [No message system available]
I then see that we can try to tell Factorio to use the OS-provided SDL2 build, which can be newer and include wayland backend:
Code: Select all
% env SDL_VIDEODRIVER=wayland SDL_DYNAMIC_API=/usr/lib64/libSDL2.so ./bin/x64/factorio
0.000 2022-06-11 12:07:03; Factorio 1.1.59 (build 59719, linux64, full)
0.007 Operating system: Linux (Fedora)
0.007 Program arguments: "./bin/x64/factorio"
0.007 Read data path: /home/U/factorio/Space Exploration/data
0.007 Write data path: /home/U/factorio/Space Exploration [394103/404128MB]
0.007 Binaries path: /home/U/factorio/Space Exploration/bin
0.011 System info: [CPU: AMD Ryzen 7 5800H with Radeon Graphics, 16 cores, RAM: 60123 MB]
0.011 Environment: DISPLAY=<unset> WAYLAND_DISPLAY=wayland-1 DESKTOP_SESSION=<unset> XDG_SESSION_DESKTOP=<unset> XDG_CURRENT_DESKTOP=<unset> __GL_FSAA_MODE=<unset> __GL_LOG_MAX_ANISO=<unset>
__GL_SYNC_TO_VBLANK=<unset> __GL_SORT_FBCONFIGS=<unset> __GL_YIELD=<unset>
0.011 Display options: [FullScreen: 1] [VSync: 0] [UIScale: custom (125.0%)] [Native DPI: 1] [Screen: 255] [Special: lmw] [Lang: en]
Factorio crashed. Generating symbolized stacktrace, please wait ...
/tmp/factorio-build-Xa3JcI/src/Util/Logger.cpp (313): Logger::writeStacktrace(FileWriteStream*, StackTraceInfo*) [clone .constprop.0]
/tmp/factorio-build-Xa3JcI/src/Util/Logging.cpp (101): Logging::logAndAbortOrThrow(char const*, unsigned int, LogLevel, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<ch
ar> > const&) [clone .constprop.0]
/tmp/factorio-build-Xa3JcI/src/Util/Logging.cpp (93): Logging::logAndAbortOrThrow(char const*, unsigned int, LogLevel, char const*, ...) [clone .constprop.0]
/tmp/factorio-build-Xa3JcI/src/Graphics/SDLWindow.cpp (117): SDLWindow::SDLWindow(GraphicsInterface::Type, WindowPositionData) [clone .constprop.0]
/tmp/factorio-build-Xa3JcI/src/Graphics/SDLWindow.cpp (103): SDLWindow::SDLWindow(GraphicsInterface::Type, short, short, bool)
/tmp/factorio-build-Xa3JcI/src/GlobalContext.cpp (923): GlobalContext::loadGraphics(std::optional<WindowPositionData>) [clone .isra.0]
/tmp/factorio-build-Xa3JcI/src/GlobalContext.cpp (450): GlobalContext::init(bool, bool, bool, std::optional<WindowPositionData>) [clone .constprop.0] [clone .isra.0]
/tmp/factorio-build-Xa3JcI/src/MainLoop.cpp (272): MainLoop::run(Filesystem::Path const&, Filesystem::Path const&, bool, bool, std::function<void ()>, Filesystem::Path const&, MainLoop::HeavyMod
e)
/tmp/factorio-build-Xa3JcI/src/Main.cpp (1142): main
0x7f256bfd01e9
__libc_start_main
0x76195d
0xffffffffffffffff
Stack trace logging done
0.089 Error SDLWindow.cpp:117: SDL couldn't be initialized. SDL_Error: wayland not available
Logger::writeStacktrace skipped.
0.089 Error Util.cpp:97: Unexpected error occurred. If you're running the latest version of the game you can help us solve the problem by posting the contents of the log file on the Factorio
forums.
Please also include the save file(s), any mods you may be using, and any steps you know of to reproduce the crash.
0.089 Error MessageDialog.cpp:53: Unable to show message dialog. SDL Error: [No message system available]
Code: Select all
% cat sdl_test_wayland.c
#include <stdio.h>
#include <SDL.h>
int main( int argc, char *argv[] ) {
if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) {
printf( "SDL_Init() error: %s\n", SDL_GetError() );
return 1;
}
printf( "SDL_Init() succeeded.\n" );
printf( "SDL_GetCurrentVideoDriver(): %s\n", SDL_GetCurrentVideoDriver() );
return 0;
}
Code: Select all
% gcc -o sdl_test_wayland sdl_test_wayland.c -g -lSDL2 -lGL -I/usr/include/SDL2
Code: Select all
% ./sdl_test_wayland
SDL_Init() succeeded.
SDL_GetCurrentVideoDriver(): wayland
for further experimentation, I've added the OS-provided SDL2 to LD_PRELOAD, but I guess that doesn't work for overriding statically bundled libraries.