GodotVR / godot_openxr

(Maintenance mode) OpenXR drivers for the Godot Game Engine v3.x
MIT License
277 stars 43 forks source link

Linux/alvr #199

Open gattila opened 2 years ago

gattila commented 2 years ago

Hi!

I created a small test VR application for Godot 3.5 beta2 under linux with the OpenXR plugin. I compiled it to Android and deployed to my Occulus Quest2 and it works fine. But is there any way to run my app in desktop mode, like on windows ? As I read, it supports StreamVR on linux. Is there any way to run my app on linux using https://github.com/alvr-org/ALVR ? Or any other way instead of reinstall the app on quest side for every modify/run cycle?

BastiaanOlij commented 2 years ago

I haven't tried myself as I'm Windows based but there were some people discussing this on the Discord or Godot chat server the other day.

If ALVR runs on Linux through SteamVR then in theory it should work. Godot just talks to SteamVR over OpenXR and doesn't really care whats behind it. Thats the whole idea of OpenXR. But I have no personal experience with ALVR.

gattila commented 2 years ago

I installed the SteamVR on my linux, and I connected my Oculus Quest2 to SteamVR via ALVR. This part seems Ok, I can see the SteamVR virtual room on my Oculus, and the headset and controller icons are Ok on the screen, same as on windows. But when I start my VR app in Godot, nothing happens, it run as a simple desktop app. Is there any way to configure to my OpenXR app to use SteamVR? Or it happens automatically? To be honest, I am not really sure how my OpenXR app connects to SteamVR libraries. Maybe I need a plugin for this?

gattila commented 2 years ago

I tried to run the Godot (V3.5 Beta3) from console, and received the following messages:

ERROR: Can't open dynamic library: /home/attila/Src/Godot/VRDemo/addons/godot-openxr/bin/linux/libgodot_openxr.so. Error: libopenxr_loader.so.1: cannot open shared object file: No such file or directory at: open_dynamic_library (drivers/unix/os_unix.cpp:403) Mono: Log file is: '/home/attila/.local/share/godot/mono/mono_logs/2022-04-10_14.39.45_3163.log' ERROR: Can't open dynamic library: /home/attila/Src/Godot/VRDemo/addons/godot-openxr/bin/linux/libgodot_openxr.so. Error: libopenxr_loader.so.1: cannot open shared object file: No such file or directory at: open_dynamic_library (drivers/unix/os_unix.cpp:403) ERROR: No valid library handle, can't get symbol from GDNative object at: get_symbol (modules/gdnative/gdnative.cpp:510) ERROR: No nativescript_init in "res://addons/godot-openxr/bin/linux/libgodot_openxr.so" found at: init_library (modules/gdnative/nativescript/nativescript.cpp:1503) ERROR: Condition "idx == -1" is true. Returned: nullptr at: find_interface (servers/arvr_server.cpp:208)

I tried to set the LD_LIBRARY_PATH to steamvr openxr folder but it doesn't changed anything.

ChristophHaag commented 2 years ago

On linux the openxr loader (libopenxr_loader.so.1, part of the OpenXR SDK from Khronos) is not included in the godot_openxr plugin, it needs to be otherwise installed on the system. (Just like the vulkan loader has to be installed on the system to run vulkan applications).

Currently steam does not ship the OpenXR loader in the steam runtime and on older distributions it is not packaged either.

Some info about the OpenXR loader on the monado website: https://monado.freedesktop.org/getting-started.html#openxr-sdk

gattila commented 2 years ago

It is not totally, true, the SteamVR ship the OpenXR loader, but the name is libopenxr_loader.so. I created a link from ibopenxr_loader.so to libopenxr_loader.so.1 and added the folder to LD_LIBRARY_PATH and it solved the issue, it works fine (at least with my very basic VR demo).

Thanks for the help, I didn't see the difference between the filenames.

micimize commented 2 years ago

I think this can be considered "as functional as ALVR itself," as I was also able to get it working with much troubleshooting (little of it caused by godot_openxr itself). The one thing godot could do might be better surfacing the linking errors in debug mode.

Here's all of the troubleshooting I did (most of it not godot-related) on kubuntu 22.04, and being very new to linux, in case another wishes to walk the path:

  1. Unrelated / tangential problems: a. For android asset bundling you need v3.5 for some errors b. Steam requires libva-x11-2:i386 which you may be missing if steamui.so is missing
  2. I ultimately built ALVR from source of current master. Which I would recommend (their builds had openssl 1.1 dependencies due to build context, I'm sure that happens a lot with .so files)
  3. During ALVR setup you can just adb install alvr_client_oculus_quest_19.0.0-dev00.apk and you need to run that anytime you want to connect.
  4. There was a system restart in here that made some SteamVR 307 error go away
  5. tail ~/.steam/steam/logs/vrmonitor.txt -n 50 and other vr*.txt logs to see actual SteamVR errors
  6. If ARVRServer.find_interface("OpenXR"); returns null while debugging, export the project and run it. I had the same issue as gattila but didn't know for a while because the error only showed in a build.
  7. To fix the so stuff on (k)ubuntu (in my case at least):
    steamvr_sos=$HOME/.steam/debian-installation/steamapps/common/SteamVR/bin/linux64/
    ln $steamvr_sos/libopenxr_loader.so $steamvr_sos/libopenxr_loader.so.1
    sudo echo $steamvr_sos > /etc/ld.so.conf.d/steamvr_libs.conf
    sudo ldconfig
  8. During troubleshooting I installed the SteamVR beta (1.24.1) which caused a segfault. Miraculously downgrading fixed this.

I am spared from having to consider migrating to windows for another day. By which I mean this took the entire day, probably about 10 hours of troubleshooting #linux

rexxmagnus commented 2 years ago

I had the same problem connecting to SteamVR. I already have ALVR and SteamVR set up successfully, but the missing link was resolved for me (on Debian) by installing the libopenxr-loader package from the Debian repository.