minecrift icon indicating copy to clipboard operation
minecrift copied to clipboard

Vivecraft + Linux?

Open GNUGradyn opened this issue 9 years ago • 35 comments

I have a linux laptop and a google cardboard. My idea was to use vivecraft to get minecraft in a VR compatible format, and use VNC to mirror my computer screen to my phone. However, minecraft crashes when launching. Here's the error log:

---- Minecraft Crash Report ---- // Uh... Did I do that?

Time: 10/10/16 9:21 PM Description: Initializing game

java.lang.UnsatisfiedLinkError: Unable to load library 'openvr_api': Native library (linux-x86-64/libopenvr_api.so) not found in resource path ([file:/home/gradyn/.minecraft/libraries/com/mtbs3d/minecrift/1.10.2-Vivecraft-jrbudda-6r4/minecrift-1.10.2-Vivecraft-jrbudda-6r4.jar, file:/home/gradyn/.minecraft/libraries/optifine/OptiFine/1.10.2_HD_U_C2/OptiFine-1.10.2_HD_U_C2.jar, file:/home/gradyn/.minecraft/libraries/org/ow2/asm/asm-all/5.0.3/asm-all-5.0.3.jar, file:/home/gradyn/.minecraft/libraries/org/json/json/20140107/json-20140107.jar, file:/home/gradyn/.minecraft/libraries/net/minecraft/launchwrapper/1.12/launchwrapper-1.12.jar, file:/home/gradyn/.minecraft/libraries/com/sun/jna/4.2.1/jna-4.2.1.jar, file:/home/gradyn/.minecraft/libraries/de/fruitfly/ovr/JRift/0.8.0.0.1/JRift-0.8.0.0.1.jar, file:/home/gradyn/.minecraft/libraries/net/aib42/mumblelink/JMumble/1.11/JMumble-1.11.jar, file:/home/gradyn/.minecraft/libraries/java3d/vecmath/1.3.1/vecmath-1.3.1.jar, file:/home/gradyn/.minecraft/libraries/com/mojang/netty/1.6/netty-1.6.jar, file:/home/gradyn/.minecraft/libraries/oshi-project/oshi-core/1.1/oshi-core-1.1.jar, file:/home/gradyn/.minecraft/libraries/net/java/dev/jna/jna/3.4.0/jna-3.4.0.jar, file:/home/gradyn/.minecraft/libraries/net/java/dev/jna/platform/3.4.0/platform-3.4.0.jar, file:/home/gradyn/.minecraft/libraries/com/ibm/icu/icu4j-core-mojang/51.2/icu4j-core-mojang-51.2.jar, file:/home/gradyn/.minecraft/libraries/net/sf/jopt-simple/jopt-simple/4.6/jopt-simple-4.6.jar, file:/home/gradyn/.minecraft/libraries/com/paulscode/codecjorbis/20101023/codecjorbis-20101023.jar, file:/home/gradyn/.minecraft/libraries/com/paulscode/codecwav/20101023/codecwav-20101023.jar, file:/home/gradyn/.minecraft/libraries/com/paulscode/libraryjavasound/20101123/libraryjavasound-20101123.jar, file:/home/gradyn/.minecraft/libraries/com/paulscode/librarylwjglopenal/20100824/librarylwjglopenal-20100824.jar, file:/home/gradyn/.minecraft/libraries/com/paulscode/soundsystem/20120107/soundsystem-20120107.jar, file:/home/gradyn/.minecraft/libraries/io/netty/netty-all/4.0.23.Final/netty-all-4.0.23.Final.jar, file:/home/gradyn/.minecraft/libraries/com/google/guava/guava/17.0/guava-17.0.jar, file:/home/gradyn/.minecraft/libraries/org/apache/commons/commons-lang3/3.3.2/commons-lang3-3.3.2.jar, file:/home/gradyn/.minecraft/libraries/commons-io/commons-io/2.4/commons-io-2.4.jar, file:/home/gradyn/.minecraft/libraries/commons-codec/commons-codec/1.9/commons-codec-1.9.jar, file:/home/gradyn/.minecraft/libraries/net/java/jinput/jinput/2.0.5/jinput-2.0.5.jar, file:/home/gradyn/.minecraft/libraries/net/java/jutils/jutils/1.0.0/jutils-1.0.0.jar, file:/home/gradyn/.minecraft/libraries/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar, file:/home/gradyn/.minecraft/libraries/com/mojang/authlib/1.5.22/authlib-1.5.22.jar, file:/home/gradyn/.minecraft/libraries/com/mojang/realms/1.9.6/realms-1.9.6.jar, file:/home/gradyn/.minecraft/libraries/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar, file:/home/gradyn/.minecraft/libraries/org/apache/httpcomponents/httpclient/4.3.3/httpclient-4.3.3.jar, file:/home/gradyn/.minecraft/libraries/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar, file:/home/gradyn/.minecraft/libraries/org/apache/httpcomponents/httpcore/4.3.2/httpcore-4.3.2.jar, file:/home/gradyn/.minecraft/libraries/it/unimi/dsi/fastutil/7.0.12_mojang/fastutil-7.0.12_mojang.jar, file:/home/gradyn/.minecraft/libraries/org/apache/logging/log4j/log4j-api/2.0-beta9/log4j-api-2.0-beta9.jar, file:/home/gradyn/.minecraft/libraries/org/apache/logging/log4j/log4j-core/2.0-beta9/log4j-core-2.0-beta9.jar, file:/home/gradyn/.minecraft/libraries/org/lwjgl/lwjgl/lwjgl/2.9.4-nightly-20150209/lwjgl-2.9.4-nightly-20150209.jar, file:/home/gradyn/.minecraft/libraries/org/lwjgl/lwjgl/lwjgl_util/2.9.4-nightly-20150209/lwjgl_util-2.9.4-nightly-20150209.jar, file:/home/gradyn/.minecraft/versions/vivecraft-1.10.2-Vivecraft-jrbudda-6r4/vivecraft-1.10.2-Vivecraft-jrbudda-6r4.jar]) at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:277) at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:403) at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:342) at jopenvr.JOpenVRLibrary.(JOpenVRLibrary.java:17) at com.mtbs3d.minecrift.provider.MCOpenVR.init(MCOpenVR.java:285) at bcx.initMinecrift(Minecraft.java:4465) at bcx.an(Minecraft.java:751) at bcx.a(Minecraft.java:640) at net.minecraft.client.main.Main.main(SourceFile:124) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

A detailed walkthrough of the error, its code path and all known details is as follows:

-- Head -- Thread: Client thread Stacktrace: at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:277) at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:403) at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:342) at jopenvr.JOpenVRLibrary.(JOpenVRLibrary.java:17) at com.mtbs3d.minecrift.provider.MCOpenVR.init(MCOpenVR.java:285) at bcx.initMinecrift(Minecraft.java:4465) at bcx.an(Minecraft.java:751)

-- Initialization -- Details: Stacktrace: at bcx.a(Minecraft.java:640) at net.minecraft.client.main.Main.main(SourceFile:124) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

-- System Details -- Details: Minecraft Version: 1.10.2 Operating System: Linux (amd64) version 4.4.0-36-generic Java Version: 1.8.0_91, Oracle Corporation Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 149476360 bytes (142 MB) / 286863360 bytes (273 MB) up to 2120679424 bytes (2022 MB) JVM Flags: 5 total; -Xmx2G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn256M IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 Launched Version: vivecraft-1.10.2-Vivecraft-jrbudda-6r4 LWJGL: 2.9.4 OpenGL: Mesa DRI Intel(R) Haswell Mobile GL version 3.0 Mesa 12.1.0-devel, Intel Open Source Technology Center GL Caps: Using GL 1.3 multitexturing. Using GL 1.3 texture combiners. Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported. Shaders are available because OpenGL 2.1 is supported. VBOs are available because OpenGL 1.5 is supported.

Using VBOs: Yes
Is Modded: Very likely; Jar signature invalidated
Type: Client (map_client.txt)
Resource Packs: texture.zip
Current Language: English (US)
Profiler Position: N/A (disabled)
CPU: 2x Intel(R) Celeron(R) 2957U @ 1.40GHz
OptiFine Version: OptiFine_1.10.2_HD_U_C2
Render Distance Chunks: 32
Mipmaps: 4
Anisotropic Filtering: 1
Antialiasing: 0
Multitexture: false
Shaders: null
OpenGlVersion: 3.0 Mesa 12.1.0-devel
OpenGlRenderer: Mesa DRI Intel(R) Haswell Mobile 
OpenGlVendor: Intel Open Source Technology Center
CpuCount: 2

GNUGradyn avatar Oct 11 '16 03:10 GNUGradyn

Yeah we don't support Linux currently, we haven't yet looked into how exactly to get the native library for it working. And in any case, just mirroring your screen to the phone won't work, Vivecraft needs a connection to a headset through SteamVR for tracking and such.

To get SteamVR working on Linux I believe you have to compile it yourself, and then to get the phone working as a VR headset you have to use RiftCat VRidge. Problem is, that's a Windows-only application and I don't think there's anything like it for Linux. Honestly, you may just have to dual-boot Windows on your laptop.

Techjar avatar Oct 11 '16 03:10 Techjar

Try this one. I can't remember if its the same as the released one but I'm fairly sure this one is supposed to installed the linux natives.

vivecraft-1.10.2-Vivecraft-jrbudda-6r4-installer.jar.zip

jrbudda avatar Oct 11 '16 06:10 jrbudda

Oh is it? Still, VRidge only works on windows so I'm not sure how he'll get it to work. Vivecraft will just break without a headset to display to.

Techjar avatar Oct 11 '16 20:10 Techjar

@Techjar is right. It tells me there was no headset detected. Is there any way to make a dummy vive or somthing? I'm just trying to get minecraft in 3D SBS

GNUGradyn avatar Oct 12 '16 00:10 GNUGradyn

yea vridge is a dummy vive, you'll need something like that

jrbudda avatar Oct 12 '16 02:10 jrbudda

The file vivecraft-1.10.2-Vivecraft-jrbudda-6r4-installer.jar.zip works on Linux. However, it has trouble detecting the Vive afterwards, but that might be a problem of the libopenvr, and not vivecraft. I'm not quite sure on how to debug that, any hints?

Seegras avatar Nov 06 '16 13:11 Seegras

Neither of us have ever tried to use the Vive or Vivecraft on Linux, so unfortunately you're on your own there. I've seen a few articles about people getting the Vive working on Linux, so just search around and maybe you'll get somewhere.

Techjar avatar Nov 06 '16 18:11 Techjar

This here: http://wiki.vg/Debugging gave some hints on enabling debug output. Note that the second example xml is broken, it contains the header-line twice, which will make java ignore the whole file. HOWEVER, this only gives debug-output already thought of in the source. As long as nothing throws an exception, it won't output anything either. So basically, this only helps if vivecraft would put out debug output hint ;).

I later tried with strace, which is quite difficult to get to work, since I couldn't get Minecraft to run without the loader, so I did it with this mess: "strace -p ps auxww | grep java | grep -v Minecraft.jar | grep -v grep | cut -d " " -f 4 -f 2> ERR", started while Minecraft was starting up. What I got is this:

open("/usr/lib/libaitcamlib.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)

Well, that and 20 attempts more in different paths. Anyway, basically it could not find the library because it didn't look in the SteamVR path. I'd really appreciate it if vivecraft would pass through errors thrown by the libraries it depends on.

I expect there are more libraries it can't find (but that would be available).

Seegras avatar Nov 20 '16 15:11 Seegras

I've got it running on Linux. Mostly it was a case of steam and steamVR using libraries linked against ancient other libraries. Like this: ldd driver_lighthouse.so | grep udev libudev.so.0 => not found (libudev.so.1 would be contemporary)

It's jittery, the controls are weird, and my initial point-of-view is totally skewed (about 5 metres below and to the right of the menu; it's visible as small strip. I need to hide the Vive, so I can see the menu on the desktop, place the mouse in front on the "reset origin", put on the Vive and click the button.

Opening a container, inventory or workbench does nothing (actually, this might be related to the above point-of-view problem, maybe the screen opens somewhere else, where I can't see it.).

Seegras avatar Nov 27 '16 20:11 Seegras

Awesome that you got it working! Yeah, not sure why the inventories wouldn't be opening. It's definitely something screwed with your OpenVR, as there wouldn't be anything on the Java side that would cause that only on Linux.

Techjar avatar Nov 27 '16 23:11 Techjar

What would help is if you could assign a key to "reset origin". It probably would help others, because if you need to do this, you might have problems clicking on something.

Oh, and of course, I probably need a newer build, the one I tried with is several weeks old: https://github.com/jrbudda/minecrift/files/521066/vivecraft-1.10.2-Vivecraft-jrbudda-6r4-installer.jar.zip

Seegras avatar Nov 28 '16 10:11 Seegras

What are you using for a headset that the origin needs resetting?

jrbudda avatar Nov 28 '16 13:11 jrbudda

A Vive. The trouble is, all the SteamVR Software for calibrating etc. ist not released on Linux yet. Only the driver (which is used by Vivecraft) is.

Addendum: With the Room Setup from SteamVR, the issue of the skewed origin of course became moot. I still can't get a container/workbench/inventory view tough.

Seegras avatar Nov 30 '16 07:11 Seegras

ohh I gotcha. TBH given the choice between trying to fudge something to work and just waiting for Valve to fully support steamVR on linux I have to choose the latter. Might be worth your while to dual boot Windows to make the best use of your headset.

jrbudda avatar Nov 30 '16 14:11 jrbudda

Now we have SteamVR officially on Linux.

For mesa (and all other actually OpenGL compliant compilers) it needs this small fix: https://github.com/jrbudda/minecrift/pull/275

The windows installer can be extracted with file-roller and then the java installer can be run withjava -cp . Installer.

Two libraries are 404: JMumbleLibrary:1.11 and JRiftLibrary:0.8.0.0.1. I don't care about them so I edited the versions json file to download the windows libraries instead.

with all of this fixed, we get something that runs, but I haven't tried further than the world choice menu yet.

Edit: The Vive controllers are shown and track fine, but clicking buttons doesn't do anything.

ChristophHaag avatar Feb 22 '17 21:02 ChristophHaag

Our "exe" installer is actually just a jar put through launch4j, so you can just run it directly with java.

Techjar avatar Feb 22 '17 21:02 Techjar

Now I feel stupid. :)

ChristophHaag avatar Feb 22 '17 21:02 ChristophHaag

I also have no buttons working.

I have tried to debug it. It seems that GetControllerState always set the VRControllerState_t structure to all zeroes, though it returns true (non zero byte). That said, buttons do generate events, but they are ignored by the event polling.

valentindavid avatar Mar 07 '17 21:03 valentindavid

sounds like a steamvr issue. Or something horribly wrong with the controller state struct

jrbudda avatar Mar 07 '17 22:03 jrbudda

I have found a bit more about the bug. When GetControllerState from the C API (through FnTable) does not work, while it does with the C++ API. I have opened a ticket ValveSoftware/SteamVR-for-Linux#35.

valentindavid avatar Mar 10 '17 11:03 valentindavid

Actually, this is an alignment problem. The buffer is 64 bytes. SteamVR on Linux expects it to be 60 bytes. Which is not the standard alignment on the platform. (Maybe it is to keep compatibility with 32 bits drivers, but that sound weird). I have not found how to fix with JNA. Initializing the structure with super(Structure.ALIGN_NONE); does not seem to work.

valentindavid avatar Mar 10 '17 22:03 valentindavid

I modified OpenVR a bit to be able to handle 64 bytes structure to test further. As @Seegras said, there is no access to inventory, workbench, chests... But it is actually more than that. There is no HUD. I tried different HUD configuration. But it never shows up.

Any idea on what could be the reason for the HUD not to show up?

valentindavid avatar Mar 11 '17 18:03 valentindavid

It could be several things... It could not be rendering at all, like throwing an exception.... it could be rendering invisibly, due to opengl issues.... or the positioning could be way off so it's rendering somewhere else in the world you cant see it.

jrbudda avatar Mar 11 '17 19:03 jrbudda

I have disabled the alpha of the GUI (like in the menu room). The GUI display at the right place. But the framebuffer is just black.

valentindavid avatar Mar 18 '17 21:03 valentindavid

That's pretty weird, I don't see why that part wouldn't work on linux. Could it be a driver issue? What hardware and drivers are you using?

Techjar avatar Mar 19 '17 09:03 Techjar

Nvidia GTX 970, with drivers version 375.27.13.

valentindavid avatar Mar 19 '17 09:03 valentindavid

I dumped the RGBA values of the GUI framebuffer every 100 frames into a file with glReadPixels. While I got the correct framebuffer dumped from the GUI from the start menu world, the GUI framebuffers while playing were all zeroes (black and transparent), including inventory and game menu.

valentindavid avatar Mar 19 '17 20:03 valentindavid

The reason is that when the GUI starts to draw GL_STENCIL_TEST is still enabled (from the main loop rendering which is not done in the menu). Adding GL11.glDisable(GL11.GL_STENCIL_TEST) in drawFrameBuffer seems to solve the issue.

valentindavid avatar Mar 20 '17 21:03 valentindavid

Hmm, the GUI framebuffer must have a stencil attachment, but it's never actually written. It probably should be disabled, yeah, but I still don't get why it behaves differently on windows and linux. Does the stencil value default to 0 on linux?

Techjar avatar Mar 20 '17 21:03 Techjar

I have no idea. This might happen only for nvidia drivers on Linux. Or it might be related to the fact that we need beta version of nvidia drivers.

I will dump the stencil from the framebuffer when I find the time and see.

valentindavid avatar Mar 20 '17 22:03 valentindavid