DOSbox and SDL error on Wayland
I tried installing DOSbox tonight to run some old games from the 90s. On first run, I got Exit to error: Can't init SDL No available video device
as output in my shell (Shell mode in Emacs). I use a Raspberry Pi 5, so my first thought was to look for video drivers, but Mesa is already installed. I looked up the SDL packages I had installed and seemed to have everything needed. After an extensive search that did not really give me any solution, I tried something someone in a forum had tried, but in a slightly different way than they did and it actually worked.
I echoed out $SDL_VIDEODRIVER
and got wayland
as my answer since I run the tiling window manager Sway. (This is also the normal answer if you run Gnome (Ubuntu, OpenSUSE, Fedora…), KDE Plasma (Kubuntu, KDE Neon…), Wayfire (Raspberry Pi OS), Qtile on Wayland or Hyperland.) I checked to make certain I had xwayland installed and then tried launching DOSbox again with SDL_VIDEODRIVER=X11 dosbox
in a terminal and it worked. It will probably work for other programs that use SDL that won't launch on Wayland as well.
My search for solutions found a lot of users of different programs that used SDL that had trouble with getting their programs to run and with no credible solution given in any of the forums I visited. I hope this blog post will help people in that situation.
I also hope programs made to run on X11 start to wake up to the reality that most GNU/Linux users use Wayland now and adjust their code. Most GUI FOSS use Qt or GTK which has worked on Wayland since Qt5 and GTK3 without any new code. The programs that need updating are programs not using those toolkits. For those still not convinced of the need to adapt to a new reality: All the major distros ship Gnome which is Wayland by default. Most GNU/Linux users are on those distros. KDE Plasma used by many of the people not using Gnome is also Wayland by default. Raspberry Pi OS uses Wayfire as their desktop now (they used LXDE before even if they called it something else) and it uses Wayland. And there are many of us tiling WM users on Wayland as well (Wayfire, Hyperland, Qtile and Sway).
X11 is very old, bloated and has not been in active development since June 6, 2012 except for security fixes. Gnome and Plasma spent a long time getting their compositors good enough for prime time and that delayed the transition for a decade and left a lot of users thinking Wayland wasn't ready while many other users, me included, were using the Wayland protocol with the wlroots compositor on Sway with few issues every day. MATE, XFCE and LXQt were cooperating on a Wayland compositor based on Lumiri's (Unity8's) Mir last time I checked, so soon, everyone except a few tiling WM users will be on Wayland. I am looking forward to not having to install Xwayland when all the program developers and package maintainers catch up to today's reality in a decade's time…