ValveSoftware / unity-xr-plugin

OpenVR plugin for Unity's XR API
BSD 3-Clause "New" or "Revised" License
309 stars 64 forks source link

UnityXR plugin is not supported on Linux #3

Open demonixis opened 4 years ago

demonixis commented 4 years ago

Hello,

The previous plugin worked on Linux, the new UnityXR one doesn't.

zite commented 4 years ago

Are you trying to build to linux or use the linux editor? I'm not sure if Unity XR itself has linux support yet.

demonixis commented 4 years ago

Hello, The manifest indicates it's working for windows and unity editor. I think changing the manifest can help. When you try to build the project is not referenced so it doesn't build.

image

Hadrien-Estela commented 4 years ago

Same for MacOS

zite commented 4 years ago

We're working through linux support with unity now. You can try to compile on your own if you like though. @Hadrien-Estela SteamVR itself no longer supports MacOS. See this post: https://steamcommunity.com/games/250820/announcements/detail/2216278054495230718

demonixis commented 4 years ago

Thanks, I'll evaluate the master branch today. You said you're working with Unity on that, does that means the Linux support has issues? What works and what doesn't work? The runtime folder doesn't including Linux in the included platforms. Is it normal that this file wasn't updated?

"includePlatforms": [
        "Editor",
        "WSA",
        "WindowsStandalone32",
        "WindowsStandalone64",
    "LinuxStandalone64"
    ],
zite commented 4 years ago

Looks like that should be fixed for builds, but the editor doesn't seem to be loading the libXRSDKOpenVR.so at all. I believe 'Editor' should cover linux while in editor.

Just tried making that fix just in case but still getting the same issue. Editor says DllNotFoundException: XRSDKOpenVR.

jpapon commented 3 years ago

Are there any updates here? Anyone have any luck loading XRSDKOpenVR in the linux editor or a build? Just want to hear if it's even possible before I go down the rabbit hole...

WaleedAmer commented 3 years ago

I also need help with this issue! Have there been any updates?

happysmash27 commented 3 years ago

@zite, I also continuously get this error when trying to load the sample scene. I am trying to develop an application very quickly. Has anybody fixed this issue yet, and is it viable to use this plug-in? Or should I try to find this older plugin people are talking about, and use that one instead?

slembcke commented 3 years ago

Also ran into the "DllNotFoundException: XRSDKOpenVR" issue. Tried the usual mono debugging I can remember to no avail, but can't remember what gotchas Unity adds, and have no idea what extra complexities it adds being a package.

slembcke commented 3 years ago

Not sure if I'm on the right path (pun intended), but I think this is a relative path issue due to how libXRSDKOpenVR.so is linked. If I make a minimal .cs file that loads SetUserDefinedSettings() from libXRSDKOpenVR.so it works just fine. However, when I copied the .cs and .so to a different folder to make a more minimal replication, I started getting a DllNotFoundException: XRSDKOpenVR just like from Unity. Eventually I tried opening it with dlopen(), and that fails with more useful information: lib/x64/libopenvr_api.so: cannot open shared object file: No such file or directory When I put the second library in the expected relative path, both the dlopen() and .cs version work fine again.

Anyway, so my theory is that this probably works just fine on whatever machine it was developed on, but was maybe never tested as an installed package. Somehow the packaged version doesn't have working paths or something? This might be a giant red herring, but I'll keep digging.

EDIT: Confirmed! It's a relative path issue. Copying the lib/ directory to the root level of my project fixes the DllNotFoundException. Unfortunately it still doesn't work. It fails to load the XR plugin unless I open the settings pane for it explicitly, and then gives me this unhelpful error from deep inside Unity:

XR display is not ready. Skip XR rendering. UnityEngine.Rendering.RenderPipelineManager:DoRenderLoop_Internal (UnityEngine.Rendering.RenderPipelineAsset,intptr,Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle) (at /home/bokken/buildslave/unity/build/Runtime/Export/RenderPipeline/RenderPipelineManager.cs:86)

I guess I should try launching my other project using the legacy OpenVR stuff to check. It was working a couple days ago anyway.

Unity 2019.4.28f1 LTS + SteamVR 1.18.7 running on PopOS 20.04 LTS

EDIT 2: Tried again with Unity 2020.3.12f and the "not ready" error goes away, but nothing happens. I threw a log statement into the OpenVRLoader.Initialize() method and it is being run, but the TrackedPoseDriver doesn't work, nothing is output to the HMD, and it doesn't even show the "loading Unity" popup in the HMD it usually does when launching. I guess I should try on fixing my Windows Update disaster and try it again there to make sure I'm not missing something. I've been hiding on Linux to avoid dealing with that. (sigh)

pss959 commented 3 years ago

Thanks to everyone who is looking into this!

I am having the same problem with Unity 2021.1.14f1. I worked around the DllNotFoundException problem by creating lib/x64/ in my project and linking to the libopenvr_api.so file there, since the libXRSDKOpenVR.so dlopen problem is due to it not finding this dependency.

But it still did not display in VR. No errors in the console, but I saw this error in the log: [XR] [OpenVR] [Error] Unsupported graphics api! Only DirectX and Vulkan are supported at this time.Loaded scene 'Temp/__Backupscenes/0.backup'

So I moved Vulkan above OpenGLCore in the Rendering settings and restarted the editor. This resulted in a SIGSEGV every time I tried to play the scene:

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

Caught fatal signal - signo:11 code:1 errno:0 addr:(nil)
Obtained 16 stack frames.
#0  0x007f87b3cd91f0 in funlockfile
#1             (nil) in (Unknown)
#2  0x007f8517adfe65 in CVRCompositorSharedTextures::UpdateTextureSet(CVRCompositorSharedTextures::Params const*, VRCompositorState_TextureSet_t*)
#3  0x007f8517ad4509 in CVRCompositorClient::SubmitWithArrayIndex(vr::EVREye, vr::Texture_t const*, unsigned int, vr::VRTextureBounds_t const*, vr::EVRSubmitFlags)
#4  0x007f85c53f39a8 in OpenVRDisplayProvider::SubmitToCompositor(vr::EVREye, int)
#5  0x007f85c53f23ac in OpenVRDisplayProvider::GfxThread_SubmitCurrentFrame()
#6  0x007f85c53f13a5 in GfxThread_SubmitCurrentFrame(void*, void*)
#7  0x005588c61886a7 in XRDisplaySubsystem::GfxThread::AfterRendering()
#8  0x005588c537d980 in GfxDeviceVK::InsertCustomMarkerCallbackAndData(void (*)(int, void*), int, void*, unsigned long)
#9  0x005588c713b7fc in GfxDeviceWorker::RunCommand(ThreadedStreamBuffer&)
#10 0x005588c713d8ff in GfxDeviceWorker::RunExt(ThreadedStreamBuffer&)
#11 0x005588c713d8c7 in GfxDeviceWorker::Run()
#12 0x005588c7132d76 in GfxDeviceWorker::RunGfxDeviceWorker(void*)
#13 0x005588c596ed01 in Thread::RunThreadWrapper(void*)
#14 0x007f87b3cce450 in start_thread
#15 0x007f87b3bf0d53 in clone
Launching bug reporter
QObject: Cannot create children for a parent that is in a different thread.
(Parent is QObject(0x1162020), parent's thread is QThread(0xde7620), current thread is Thread(0xf4ee60)
===================================================================================

I'm giving up for now. :-(

Dessix commented 2 years ago

Mine loaded in VR on Kubuntu after symlinking libopenvr_api.so and libXRSDKOpenVR.so like this- but I can't seem to get the manifests to be configured in such a way as to obviate the need for the symlinks. Any ideas on how to get Unity to recognize the need for these shared libraries automatically?

(Kubuntu, Unity 2022.1b, SteamVR 2.7.3, OpenVR XR 1.1.4; Player was set to Vulkan as the primary graphics API on Linux and Windows)

CrystallisedEntertainment commented 2 years ago

Quick update: I also am coming up with the following error in the console: DllNotFoundException: UnityOpenXR UnityEngine.XR.OpenXR.OpenXRLoaderBase.Initialize () (at Library/PackageCache/com.unity.xr.openxr@1.4.2/Runtime/OpenXRLoader.cs:177) UnityEngine.XR.Management.XRManagerSettings.InitializeLoaderSync () (at Library/PackageCache/com.unity.xr.management@4.2.0/Runtime/XRManagerSettings.cs:190) UnityEngine.XR.Management.XRGeneralSettings.InitXRSDK () (at Library/PackageCache/com.unity.xr.management@4.2.0/Runtime/XRGeneralSettings.cs:175) UnityEngine.XR.Management.XRGeneralSettings.AttemptInitializeXRSDKOnLoad () (at Library/PackageCache/com.unity.xr.management@4.2.0/Runtime/XRGeneralSettings.cs:148)

Nothing shows up in my headset and nothing is being tracked. Hope they fix it soon as the side-project I am doing has been grinded to a halt for now. (I hope I've mentioned this to the right people as it is confusing which OpenXR implementation I'm using right now... ^^")

Tested on:

I also want to quickly preface that I did also try OpenVR from the Asset Store to get around this problem, but that was spuing errors like no tomorrow!

CrystallisedEntertainment commented 2 years ago

Quick update: I also am coming up with the following error in the console: DllNotFoundException: UnityOpenXR UnityEngine.XR.OpenXR.OpenXRLoaderBase.Initialize () (at Library/PackageCache/com.unity.xr.openxr@1.4.2/Runtime/OpenXRLoader.cs:177) UnityEngine.XR.Management.XRManagerSettings.InitializeLoaderSync () (at Library/PackageCache/com.unity.xr.management@4.2.0/Runtime/XRManagerSettings.cs:190) UnityEngine.XR.Management.XRGeneralSettings.InitXRSDK () (at Library/PackageCache/com.unity.xr.management@4.2.0/Runtime/XRGeneralSettings.cs:175) UnityEngine.XR.Management.XRGeneralSettings.AttemptInitializeXRSDKOnLoad () (at Library/PackageCache/com.unity.xr.management@4.2.0/Runtime/XRGeneralSettings.cs:148)

Nothing shows up in my headset and nothing is being tracked. Hope they fix it soon as the side-project I am doing has been grinded to a halt for now. (I hope I've mentioned this to the right people as it is confusing which OpenXR implementation I'm using right now... ^^")

Tested on:

* Fedora 36 Workstation (under x11 Windowing System)

* Unity 2020.3.37f1 (found to be the most stable)
  - Using the Vulkan renderer under the Linux.

* OpenXR 1.12.1

* SteamVR 1.22.13
  - Valve Index

I also want to quickly preface that I did also try OpenVR from the Asset Store to get around this problem, but that was spuing errors like no tomorrow!

Okay, I know this time I'm using the correct OpenXR thing with this one as I downloaded the experimental 1.1.5 directly fom GitHub. Got the following error when I tried to fire up my game for a quick test: [OpenVR] Could not initialize OpenVR. Error code: Init_PathRegistryNotFound UnityEngine.Debug:LogError (object) Unity.XR.OpenVR.OpenVRLoader:Initialize () (at Library/PackageCache/com.valvesoftware.unity.openvr@ed75ef5483b5/Runtime/OpenVRLoader.cs:195) UnityEngine.XR.Management.XRGeneralSettings:AttemptInitializeXRSDKOnLoad () (at Library/PackageCache/com.unity.xr.management@4.2.0/Runtime/XRGeneralSettings.cs:148)

Since I'm a total noob at this, I don't know if this is because I set something wrong in the project, but I'm leaving this here just in case that isn't the case. Tested using the same as before with the exception of using "OpenVR Unity XR Package 1.1.5" than other other OpenXR plugin from yesterday.

OwlchemyDawson commented 1 year ago

I ran into an issue of the package not being able to locate and load the action.json file due to the UserDefinedSettings actionManifestPath containing both back and forward slashes on Ubuntu 22.04.1 (jammy).

Setup:

Pull request #126 has a fix for the issue that I tested locally.

Below is an excerpt of the Unity Player.log from a test run on Ubuntu showing the original issue that the pull request resolves:

[Subsystems] Loading plugin XRSDKOpenVR for subsystem OpenVR Display... [XR] [OpenVR] Registering providers [XR] [OpenVR] Display lifecyle provider registered [Subsystems] XRSDKOpenVR successfully registered Provider for OpenVR Display [XR] [OpenVR] Input lifecycle provider registered [Subsystems] XRSDKOpenVR successfully registered Provider for OpenVR Input [Subsystems] XRSDKOpenVR successfully registered Provider for OpenVR Display [XR] [OpenVR] static Initialize: [XR] [OpenVR] Starting Initialize [XR] [OpenVR] Initializing application at: /home/test/TestGameVR/TestGameVR.x86_64 [XR] [OpenVR] Loaded settings: Editor App Name : [XR] Editor App Key : [XR] Action Manifest Path : /home/test/TestGameVR/TestGameVR_Data/StreamingAssets\SteamVR\actions.json [XR] Stereo Rendering Mode : Single Pass Instanced [XR] Initialization Type : Scene [XR] Mirror View Mode : Right Eye [XR] [OpenVR] [path] /home/test/TestGameVR [XR] [OpenVR] [Error] Action manifest file does not exist at path (/home/test/VSBuildTestOriginal\Assets\/home/test/TestGameVR/TestGameVR_Data/StreamingAssets\SteamVR\actions.json) [XR] [OpenVR] startupInfo: { "action_manifest_path": "/home/test/TestGameVR/Assets//home/test/TestGameVR/TestGameVR_Data/StreamingAssets/SteamVR/actions.json" } [XR] [OpenVR] [ERROR] VR_Init initError: VRInitError_Init_HmdNotFoundPresenceFailed [XR] [OpenVR] Starting Initialize [XR] [OpenVR] startupInfo: { "action_manifest_path": "/home/test/VSBuildTestOriginal/Assets//home/test/TestGameVR/TestGameVR_Data/StreamingAssets/SteamVR/actions.json" } /home/test/.steam/debian-installation/steamapps/common/SteamVR/bin/linux64/vrmonitor: error while loading shared libraries: libsteam_api.so: cannot open shared object file: No such file or directory [XR] [OpenVR] [ERROR] VR_Init initError: VRInitError_Init_HmdNotFoundPresenceFailed [XR] [OpenVR] XR OpenVR Display Shutdown [XR] [OpenVR] Shutdown