AirSim icon indicating copy to clipboard operation
AirSim copied to clipboard

Could not initialize SDL: XRandR support is required but not available

Open UPUPGOO opened this issue 7 years ago • 19 comments

LogInit: Warning: Could not initialize SDL: XRandR support is required but not available LogInit: Error: FLinuxApplication::CreateLinuxApplication() : InitSDL() failed, cannot create application instance. LogLinux: FLinuxPlatformMisc::RequestExit(bForce=true, ReturnCode=1) LogLinux: FLinuxPlatformMisc::RequestExit(1)

When I run AirSimNH.sh, errors occured.[https://github.com/Microsoft/AirSim/releases] So what can I do? Thank you for your answer.

UPUPGOO avatar Jan 15 '19 11:01 UPUPGOO

Are you using xvfb? Can you share the output of $ echo $DISPLAY and $ xdpyinfo | grep version? This might be helpful. Also, are you running this inside a docker container or a server? FWIW, we updated AirSimNH linux binary late last week, might be worth trying again. However, my hunch is that's not the root cause here.

madratman avatar Jan 22 '19 17:01 madratman

Thank you for your reply! I am using Microsoft's Remote Desktop connecting to Ubuntu(I runned AirSim inside a server not a docker container). image

Also,I will try newest AirSimNH linux binary.Thanks.

UPUPGOO avatar Jan 23 '19 02:01 UPUPGOO

hey @UPUPGOO. So, I couldn't figure it out what was the cause the last time we talked about it.

But today, I faced the exact same issue myself, and have found a workaround - disable xinerama by disabling the monitor using the default Intel GPU in nvidia-settings. I am not sure if your situation is similar to mine, but xinerama seems to be the culprit here. Enabling it disables xrandr. (https://bugs.launchpad.net/ubuntu/+source/xrandr/+bug/295313 , https://www.linuxquestions.org/questions/fedora-35/x-org-xinerama-and-randr-%2Asigh%2A-598941/)

In my case, I have a dual monitor setup and one is using the defaul Intel GPU, and another an Nvidia GPU, AND Xinerama was enabled in nvidia-settings: xrandr_bug_1

Now if I uncheck the xinerama enabled box in the above image, only the intel gpu is used, and the monitor connected to nvidia does not work and shows a black screen (and unreal would use the intel gpu), which is not what we want. Xinerama is used for relative positioning of the displays here (although xrandr should be able to do it as well?).

So, well I just disabled the monitor using intel gpu, and disableds xinerama, and the error goes away.

The unreal building on linux wiki page offers a better solution for multi-monitor setup. Ctrl+F "SDL2 with multi-monitor support" in there and you'll see :

# install deps
$ sudo apt-get install libxinerama-dev libxrandr-dev x11proto-xinerama-dev
# then re-build SDL2 in Engine source code
$ cd PATHTOUNREALENGINE/Engine/Source/ThirdParty/SDL2 && ./build.sh

However, running ./build.sh in there leads to an error saying vulkan.h being not found:

[ 86%] Building C object CMakeFiles/SDL2-static.dir/src/video/x11/SDL_x11xinput2.c.o
In file included from /home/madratman/projects/UnrealEngine/Engine/Source/ThirdParty/SDL2/SDL-gui-backend/src/video/x11/SDL_x11video.c:42:0:
/home/madratman/projects/UnrealEngine/Engine/Source/ThirdParty/SDL2/SDL-gui-backend/src/video/x11/SDL_x11vulkan.h:23:27: fatal error: vulkan/vulkan.h: No such file or directory
compilation terminated.
CMakeFiles/SDL2-static.dir/build.make:1583: recipe for target 'CMakeFiles/SDL2-static.dir/src/video/x11/SDL_x11video.c.o' failed
make[2]: *** [CMakeFiles/SDL2-static.dir/src/video/x11/SDL_x11video.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /home/madratman/projects/UnrealEngine/Engine/Source/ThirdParty/SDL2/SDL-gui-backend/src/video/x11/SDL_x11vulkan.c:7:0:
/home/madratman/projects/UnrealEngine/Engine/Source/ThirdParty/SDL2/SDL-gui-backend/src/video/x11/SDL_x11vulkan.h:23:27: fatal error: vulkan/vulkan.h: No such file or directory
compilation terminated.
CMakeFiles/SDL2-static.dir/build.make:1596: recipe for target 'CMakeFiles/SDL2-static.dir/src/video/x11/SDL_x11vulkan.c.o' failed
make[2]: *** [CMakeFiles/SDL2-static.dir/src/video/x11/SDL_x11vulkan.c.o] Error 1
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/SDL2-static.dir/all' failed
make[1]: *** [CMakeFiles/SDL2-static.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

Well, you can try installing vulkan from here https://vulkan-tutorial.com/Development_environment#page_Vulkan_SDK. And try again.

But I think a better solution is figuring out why relative positioning of monitors / the monitor connected to nvidia gpu's display port doesn't work with xinerama being disabled in nvidia-settings. Dunno how to do that. @sytelus @msb336 any ideas?

madratman avatar Feb 25 '19 19:02 madratman

@UPUPGOO I faced this yet once again while working on dockerfiles for airsim in https://github.com/Microsoft/AirSim/pull/1868 Thought I'll just share that I was able to resolve it by an sudo apt-get install x11-xserver-utils. If this is not an issue anymore, let's close it?

madratman avatar Apr 03 '19 22:04 madratman

@UPUPGOO please comment / reopen issue if the above comment doesn't resolve it.

madratman avatar Apr 10 '19 16:04 madratman

I met same problem when running UnrealEngine.

[2020.01.22-06.05.51:870][ 0]LogInit: Warning: Could not initialize SDL: XRandR support is required but not available [2020.01.22-06.05.51:870][ 0]LogInit: Warning: FLinuxSplashState::InitSplashResources() : InitSDL() failed, there will be no splash. [2020.01.22-06.05.51:870][ 0]LogInit: Initializing SDL. [2020.01.22-06.05.53:598][ 0]LogInit: Warning: Could not initialize SDL: XRandR support is required but not available [2020.01.22-06.05.53:598][ 0]LogInit: Error: FLinuxApplication::CreateLinuxApplication() : InitSDL() failed, cannot create application instance. [2020.01.22-06.05.53:598][ 0]LogLinux: FLinuxPlatformMisc::RequestExit(bForce=true, ReturnCode=1) [2020.01.22-06.05.53:598][ 0]LogLinux: FLinuxPlatformMisc::RequestExit(1) aoran.xiao@scale-gpu002:~/UnrealEngine-4.18.3-release$ echo $DISPLAY

sudo apt-get install x11-xserver-util does not work for me

how did you solve it?

xiaoaoran avatar Jan 22 '20 06:01 xiaoaoran

@xiaoaoran Can you check if one of these helps

sudo apt install libxrandr-dev sudo apt install xorg-dev

saihv avatar Jan 22 '20 15:01 saihv

@saihv I installed these two packages, but it ddn't work

By the way, I am running Xshell in windows to connect a ubuntu server for this project.

I appreciate for a solution!

xiaoaoran avatar Feb 03 '20 10:02 xiaoaoran

@UPUPGOO Did you solve it?

xiaoaoran avatar Feb 03 '20 10:02 xiaoaoran

Did anyone found a solution? I was trying to install UE4.22 in WSL and this popped out.

jawadefaj avatar Feb 23 '20 02:02 jawadefaj

Did anyone found a solution? i'm also running Xshell in windows to connect a ubuntu server

gengtsh avatar Jun 18 '20 07:06 gengtsh

I'm having the sort of the same issue. Following is my setup, the issues I had and the things I have tried so far.

Ubuntu: 18.04 UE: 4.24 and 4.25 (Everything described below was tried in both versions) GPU: RTX 8000 and RTX 6000 (two each) Nvidia driver version: 450.66

Following are the ways I tried to launch UE Editor.

  1. X11 forwarding enabled putty ssh session: with standard vulkan and then with -opengl4 argument (opengl4 enabled through config). Both showed error: LogInit: Warning: Could not initialize SDL: XRandR support is required but not available LogInit: Error: FLinuxApplication::CreateLinuxApplication() : InitSDL() failed, cannot create application instance.
  2. X11 forwarding disabled putty ssh session: with standard vulkan and then with putty ssh session with -opengl4 argument (opengl4 enabled through config). Both showed no error, But it's hanged and showed: 2]LogLinux: Warning: Unable to set desired swap interval 'Immediate'

Relevent installed packages:

libnvidia-fbc1-450:amd64                   450.66-0ubuntu0.18.04.1                          amd64        NVIDIA OpenGL-based Framebuffer Capture runtime library
libnvidia-fbc1-450:i386                    450.66-0ubuntu0.18.04.1                          i386         NVIDIA OpenGL-based Framebuffer Capture runtime library
libnvidia-gl-450:amd64                     450.66-0ubuntu0.18.04.1                          amd64        NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
libnvidia-gl-450:i386                      450.66-0ubuntu0.18.04.1                          i386         NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
xserver-xorg-video-nvidia-450              450.66-0ubuntu0.18.04.1                          amd64        NVIDIA binary Xorg driver
libxrandr-dev
org-dev

However, when I tried glxinfo (with X11 forwarding enabled putty session), I get

name of display: localhost:12.0
Error: couldn't find RGB GLX visual or fbconfig

However, I can successfully run the UE Editor at the server. This only happens with the remote login. Can someone please suggest what could be the issue here?

tharindurmt avatar Oct 11 '20 03:10 tharindurmt

same issue here. Running vncserver on a remote ubuntu 18.04 machine and using novnc. Same error !

HareshKarnan avatar Dec 14 '20 21:12 HareshKarnan

I also use vnc on remote ubuntu 18.04, same error, above suggestions didn't work for me

yadonskov avatar Dec 23 '20 12:12 yadonskov

Still having this problem as well, using VNC to connect to an Ubuntu 18.04 VM.

MasonLilly avatar Jul 12 '21 17:07 MasonLilly

hello , i resolve this problem by install gdm3,and replace gdm3 with lightgdm

1、sudo apt-get update

2、sudo apt-get -d install --reinstall lightdm

3、sudo apt-get remove --purge lightdm

4、sudo apt-get install gdm

5、sudo reboot

after reboot

1、sudo apt-get install --reinstall gnome-session

2、sudo apt-get install --reinstall ubuntu-desktop

image when you see this , maybe it work

lyfs avatar Dec 09 '21 08:12 lyfs

I tried this, but it doesn't work though

matren12138 avatar May 28 '24 12:05 matren12138

Had the same problem. I have a headless setup and run in a container. XRandR is used to set things like resolution and rotation of the screen. But I put "use-display-device" to None when generating /etc/X11/xorg.conf, making xrandr unable to find any screens and causing a crash. Fix it by following the steps from here to force GPU to render.

phatli avatar Sep 13 '24 12:09 phatli

@xiaoaoran Can you check if one of these helps

sudo apt install libxrandr-dev sudo apt install xorg-dev

good suggestions!

MuHeDing avatar Oct 11 '24 14:10 MuHeDing