microsoft / AirSim

Open source simulator for autonomous vehicles built on Unreal Engine / Unity, from Microsoft AI & Research
https://microsoft.github.io/AirSim/
Other
16.24k stars 4.52k forks source link

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

Open UPUPGOO opened 5 years ago

UPUPGOO commented 5 years ago

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.

madratman commented 5 years ago

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.

UPUPGOO commented 5 years ago

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.

madratman commented 5 years ago

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 commented 5 years ago

@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 commented 5 years ago

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

xiaoaoran commented 4 years ago

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?

saihv commented 4 years ago

@xiaoaoran Can you check if one of these helps

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

xiaoaoran commented 4 years ago

@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 commented 4 years ago

@UPUPGOO Did you solve it?

jawadefaj commented 4 years ago

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

gengtsh commented 4 years ago

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

tharindurmt commented 3 years ago

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?

HareshKarnan commented 3 years ago

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

yadonskov commented 3 years ago

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

MasonLilly commented 3 years ago

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

lyfs commented 2 years ago

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

matren12138 commented 3 months ago

I tried this, but it doesn't work though