jrbudda / minecrift

VR mod for Minecraft. For Minecraft version 1.7.10
http://www.vivecraft.org
Other
324 stars 30 forks source link

Vivecraft + Linux? #241

Open GNUGradyn opened 8 years ago

GNUGradyn commented 8 years ago

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
Techjar commented 8 years ago

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.

jrbudda commented 8 years ago

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

Techjar commented 8 years ago

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.

GNUGradyn commented 8 years ago

@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

jrbudda commented 8 years ago

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

Seegras commented 8 years ago

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?

Techjar commented 8 years ago

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.

Seegras commented 8 years ago

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

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.).

Techjar commented 8 years ago

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.

Seegras commented 8 years ago

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

jrbudda commented 8 years ago

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

Seegras commented 8 years ago

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.

jrbudda commented 8 years ago

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.

ChristophHaag commented 7 years ago

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.

Techjar commented 7 years ago

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

ChristophHaag commented 7 years ago

Now I feel stupid. :)

valentindavid commented 7 years ago

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.

jrbudda commented 7 years ago

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

valentindavid commented 7 years ago

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

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

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?

jrbudda commented 7 years ago

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.

valentindavid commented 7 years ago

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.

Techjar commented 7 years ago

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?

valentindavid commented 7 years ago

Nvidia GTX 970, with drivers version 375.27.13.

valentindavid commented 7 years ago

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

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.

Techjar commented 7 years ago

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?

valentindavid commented 7 years ago

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.

yaomtc commented 7 years ago

Drivers for Nvidia that work with SteamVR (381.22 currently) are no longer in beta, by the way. I might have to test this tomorrow...

jrbudda commented 7 years ago

Openvr 107, which we havent updated to yet, seems to want to fix the weird structure packing. I dont think they're breaking compatibility yet, but we may have to revist it in the future.

ghost commented 7 years ago

Hm, the 1.10.2 pack you posted a little further up works at this point in time. Works, as in it launches and you get to the menu in the vive. There is a problem with the controllers after you launch the client (i'll get back to that).

With the working controller you can put the marker over whatever is on the main menu, but you can't "click" or activate any of the buttons.

Now, back to the controllers: If you turn on or off any of the controllers while in the menu, the vive subsystem in vivecraft crashes so it's stuck at whatever angle and position you last had your vive at and the menu still continues running. You can hear the music and see some animations running on the menu background. If both controllers are switched "on" before launching, it now appears that they both work. There is a small render glitch where if you hold one of the controllers under the other (don't remember witch one). It looks like the render depth of the controller that is supposed to be beneath the other get's wrong render depth and looks like it's above even if it's not. It's a bit strange but not a direct problem :smile: Unless you have a newer build that the 1.10.2 lying around ? here's hoping

Techjar commented 7 years ago

The build way up there is super old now, grab the latest build as it works fine now on Linux (I've tested it). As for the OpenVR crashing thing, I noticed that too on Linux. It's not just Vivecraft breaking though, it's actually the whole vrserver crashing. When it happens I have to killall -9 the rest of the SteamVR processes (vrmonitor, vrdashboard, vrcompositor) as the vrserver refuses to start up again.

ghost commented 7 years ago

Yeah, sorry, just after posting this I saw the other repo's, sorry about that.