Can't run UnrealEditor with SDL_VIDEODRIVER=wayland

SDL2 is prebuilt and downloaded when you run Setup.sh. The file you need to rebuild is:

Engine/Source/ThirdParty/SDL2/SDL-gui-backend/lib/Unix/x86_64-unknown-linux-gnu/libSDL2_fPIC.a

I could not build this with the build.sh script in the SDL2 directory, as my system stdlib wont link with the SDK’s version. The only way I could build it was by running the RunMe.sh script in SDL2/docker, which automatically copies it to the right directory when its donw. This also fails because the version of SDL2 in the tree requires a newer libwayland-client than CentOS 7 has. So, here are all the changes I had to make:

RunMe.sh:

+BuildSDL2WithDocker x86_64-unknown-linux-gnu      centos:8
-BuildSDL2WithDocker x86_64-unknown-linux-gnu      centos:7

docker-build-sdl2.sh:

-if [ $UID -eq 0 ]; then
-  # Centos 7
-  yum install -y epel-release
-  yum install -y cmake3 make gcc-c++
-  yum install -y libXcursor-devel libXinerama-devel libxi-dev libXrandr-devel libXScrnSaver-devel libXi-devel mesa-libGL-devel mesa-libEGL-deve
l pulseaudio-libs-devel wayland-protocols-devel wayland-devel libxkbcommon-devel mesa-libwayland-egl-devel alsa-lib-devel libudev-devel
-  # Create non-privileged user and workspace
-  adduser buildmaster
-  mkdir -p /build
-  chown buildmaster:nobody -R /build
-  cd /build
-  exec su buildmaster "$0"
-fi

+ulimit -n 1024000
+cd /etc/yum.repos.d/
+sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
+sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
+yum update -y
+yum install -y epel-release cmake make gcc-c++ libXcursor-devel libXinerama-devel libXi-devel libXrandr-devel libXScrnSaver-devel libXi-devel m
esa-libGL-devel mesa-libEGL-devel pulseaudio-libs-devel wayland-protocols-devel wayland-devel libxkbcommon-devel mesa-libwayland-egl-devel alsa-
lib-devel libudev-devel
+mkdir -p /build
+cd /build

...

 OPTS+=(-DCMAKE_C_FLAGS=-gdwarf-4)
+OPTS+=(-DSDL_WAYLAND=ON)

Then:

  1. ./RunMe.sh
  2. verify you got new timestamps on the .a files in Engine/Source/ThirdParty/SDL2/SDL-gui-backend/lib/Unix/x86_64-unknown-linux-gnu/
  3. in root unreal dir, “make CrashReportClient ShaderCompileWorker UnrealLightmass InterchangeWorker UnrealPak UnrealEditor”
  4. SDL_VIDEODRIVER=wayland ./Engine/Binaries/Linux/UnrealEditor

Quite a pain but the end result is that wayland seems to work quite nicely. I’m running the NVIDIA proprietary driver on arch linux gnome wayland session, and running with xwayland was super glitchy for me. Now with native SDL wayland, it’s usable as far as I can tell.

2 Likes