Minecraft on ARM Linux? (Samsung Chromebook)
So I've been trying for over a week to get Minecraft to run on an install of Ubuntu on a Samsung Chromebook, which has ARM architecture. I've been following these instructions I found on the lwjgl forums:
- Install the Oracle JVM. Instructions here: http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html
- Download the minecraft launcher and run it once, allowing it to update and then crash.
- Install libegl1-mesa. Run the command "sudo apt-get install libegl1-mesa" in a terminal.
- Download and compile LWJGL for the ARM platform. Instructions are found here: http://rogerallen.github.io/jetson/2014/07/31/minecraft-on-jetson-tk1/
- Patch Minecraft with the libraries that result from the compile. What you need to do is this:
- Find the working directory for Minecraft. This is typically ~/.minecraft
- Navigate to the "versions" folder. Make a copy of the version folder you want to patch and rename it "x.x.xarm" (x.x.x being the version number)
- Open up the copied folder and change the jar and json files inside to the same name.
- Open up the json file and append "arm" after the version number for every instance of an LWJGL library you find inside (disregarding nightly builds)
- Navigate to ~/.minecraft/libraries/org/lwjgl/lwjgl and there will be a folder for each library inside. In each of those folders you'll find a folder marked with a version number. Append "arm" to the end of each.
- Replace the libraries inside those folders with your new libraries. When you reach "lwjgl_platform", you need to break open the .jar file and delete every library except for "liblwjgl.so". Replace that with your new ARM compiled version.
- Make sure that everywhere you see a version number (typically 2.9.1) you append "arm" to the end. This is mostly so that the minecraft launcher has no idea what the files are and doesn't attempt to update them. If you patched the json file correctly, it'll still run.
- Start the game! I might make a shell script soon that does all this for you if the instructions are too complicated.
But it's not working and I'm not sure what is going wrong. I've downloaded all the packages, and followed all the steps, and I'm not sure what is going wrong.
I'm pretty sure I've compiled LWJGL correctly. I've done everything the posts explain.
This is the error I get when I try to run Minecraft:
Java HotSpot(TM) Client VM warning: You have loaded library /home/cody-pc2/.minecraft/versions/1.8.5/1.8.5-natives-2398282912182/liblwjgl64.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
Exception in thread "main" java.lang.UnsatisfiedLinkError: /home/cody-pc2/.minecraft/versions/1.8.5/1.8.5-natives-2398282912182/liblwjgl.so: /home/cody-pc2/.minecraft/versions/1.8.5/1.8.5-natives-2398282912182/liblwjgl.so: cannot open shared object file: No such file or directory (Possible cause: can't load IA 32-bit .so on a ARM-bit platform)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1965)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1890)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1880)
at java.lang.Runtime.loadLibrary0(Runtime.java:849)
at java.lang.System.loadLibrary(System.java:1088)
at org.lwjgl.Sys$1.run(Sys.java:72)
at java.security.AccessController.doPrivileged(Native Method)
at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
at org.lwjgl.Sys.loadLibrary(Sys.java:96)
at org.lwjgl.Sys.<clinit>(Sys.java:117)
at ave.J(SourceFile:2524)
at net.minecraft.client.main.Main.main(SourceFile:41)
Solution 1:
General Notes
(I'm sorry for any spelling-, grammar- and wording-errors and over-complicated expressions and explanations, English is not my native language...)
I managed to get Minecraft running on my ARM-Chromebook; however, it may not work for future releases (perhaps you will have to modify the scripts, perhaps it won't work at all).
The Launcher I last tried this method with was 1.6.61
and the Minecraft version was 1.9.2
.
Knowing a bit of how to write bash scripts is recommendable; do NOT use my script for learning bash, I'm not good at it and you shouldn't learn bad coding practices. (This code is probably acceptable but don't use it for learning just to be sure.)
Do this at your own risk. (I don't think that anything can go wrong really; anyway, backups are always a good idea.)
My actual Answer
Working Principle
The MC-Launcher does the authentication stuff with the Mojang-Server, the updates (including library updates), profile management and then passes the required arguments to the MC-Client. The MC-Launcher also passes the library paths to the Client. By writing a java-wrapper-script we can modify the library paths passed to the client.
Choosing a newer proprietary edition of Java (optional)
As of what I heard Java 8 brings some notable performance improvements to the ARM platform. By using the version directly from Oracle you won't get automatic updates though.
You can download the proprietary Java 8 here. Go to the downloads page (the link might change from time to time which is why I didn't link directly there), choose to accept the licence and download the version you need (in my case "Linux ARM 32 Soft Float ABI"). Extract the tar file whereever you want to store it on your computer (e.g. in ~/proprietary_java/).
Starting the Launcher
If you downloaded Java 8 and didn't install it in any way (only unpacked the archive somewhere) you can launch the launcher by running e.g.
~/proprietary_java/jdk1.8.0_77/bin/java -jar ~/<path-to-the-minecraft-launcher>
.
(You may need to change the path accordingly when a newer version of Java is released at some point. You may also want to write a custom .desktop file or launch script for this.)
The Java Wrapper
This is where my solution gets a bit hacky (not in a good way). You can use this script but you may need to modify the paths:
#!/bin/bash
ARGS=$@
#echo $ARGS > /tmp/args_original #uncomment for debugging
JAVA=$HOME/proprietary_java/jdk1.8.0_77/bin/java
JAVA_LIB_SETTING="-Djava.library.path="
JAVA_LIB_PATH="$HOME/MC_libs"
MC_ORIG_LWJGL="$HOME/.minecraft/libraries/org/lwjgl/lwjgl/lwjgl/2.9.4-nightly-20150209/lwjgl-2.9.4-nightly-20150209.jar"
MC_ORIG_LWJGL_UTIL="$HOME/.minecraft/libraries/org/lwjgl/lwjgl/lwjgl_util/2.9.4-nightly-20150209/lwjgl_util-2.9.4-nightly-20150209.jar"
MC_ARM_LWJGL="$HOME/proprietary_java/MC_libs/lwjgl.jar"
MC_ARM_LWJGL_UTIL="$HOME/proprietary_java/MC_libs/lwjgl_util.jar"
ARGS=$(echo $ARGS | sed "s|$MC_ORIG_LWJGL|$MC_ARM_LWJGL|g" | sed "s|$MC_ORIG_LWJGL_UTIL|$MC_ARM_LWJGL_UTIL|g" )
ARGS=$(echo $ARGS | sed "s|-Djava.library.path=[a-zA-Z0-9_\/\\\.-]\+|$JAVA_LIB_SETTING$JAVA_LIB_PATH |g") #magic ;-)
# the magic seems to eat the space-character though; this is why it's added after JAVA_LIB_PATH (I'm not good at regex)
#"[a-zA-Z0-9_\/\\\.-]\+" explained:
# match a-z and A-Z and 0-9 and '_' and '/' and '\' and '.' and '-' (this must be at the end it seems).
# "\+": escape the '+'; match this pattern multiple times.
# (this means: start at "-Djava.library.path=" and stop replacing at the first space that occurs)
#echo $ARGS > /tmp/args_modified #uncomment for debugging
$JAVA $ARGS
Save this script e.g. as java_wrapper and make the file executable (e.g. chmod +x java_wrapper
)
Explanation:
ARGS=$@
: get the arguments passed to the wrapper (more or less the arguments passed to the MC-Client). We do this since we want to modify those and "ARGS" is a little more self-explanatory than "$@"
echo $ARGS > /tmp/args_original
: this puts all the arguments to the file /tmp/args_original. This is useful when the game doesn't launch anymore - some paths may have changed and you may need to replace a few paths. Using this you can see which paths you need to replace - more on this soon.
JAVA=$HOME/proprietary_java/jdk1.8.0_77/bin/java
: The path to the Java-executable.
JAVA_LIB_SETTING="-Djava.library.path="
: This is how java wants to get the library paths. The MC-Launcher passes them like this. Maybe this will change at some point (probably not) and then you'll need to find out how Minecraft tells Java where to look for these libraries. (Uncomment echo $ARGS > /tmp/args_original
and have a look at /tmp/args_original and search for something that looks like passing libraries; I'm sorry, I can't provide anything more clear (I did it like this) but maybe someone can provide a proper how-to in the comments?)
JAVA_LIB_PATH="$HOME/MC_libs"
: Compile libopenal and liblwjgl as mentioned here and put the files lwjgl/libs/linux/liblwjgl.so
, lwjgl/libs/lwjgl.jar
, lwjgl/libs/lwjgl_util.jar
and openal-soft-1.15.1/build/libopenal.so.1.15.1
(remove the ".1.15.1" from libopenal.so) in a directory you want to use (e.g. ~/MC_libs in my example)
MC_ORIG_LWJGL=
: This is the original path to lwjgl.jar as it is passed by the launcher. This will probably change at some point (uncomment the lines for debugging then and search for something like "lwjgl.jar" in /tmp/args_original)
MC_ORIG_LWJGL_UTIL
: This is the original path to lwjgl_util.jar as it is passed by the launcher. This will probably change at some point (uncomment the lines for debugging then and search for something like "lwjgl_util.jar" in /tmp/args_original)
MC_ARM_LWJGL
: This is the path to the lwjgl.jar that you compiled (as described in my "JAVA_LIB_PATH=" description)
MC_ARM_LWJGL_UTIL
: This is the path to the lwjgl_util.jar that you compiled (as described in my "JAVA_LIB_PATH=" description)
ARGS=$(echo $ARGS | sed "s|$MC_ORIG_LWJGL|$MC_ARM_LWJGL|g" | sed "s|$MC_ORIG_LWJGL_UTIL|$MC_ARM_LWJGL_UTIL|g" )
: Here we change the first few things in the arguments: We replace the path $MC_ORIG_LWJGL with $MC_ARM_LWJGL and $MC_ORIG_LWJGL_UTIL with $MC_ARM_LWJGL_UTIL.
ARGS=$(echo $ARGS | sed "s|-Djava.library.path=[a-zA-Z0-9_\/\\\.-]\+|$JAVA_LIB_SETTING$JAVA_LIB_PATH |g") #magic ;-)
: Here we replace the library path (which is something that actually may change at some point) with our library path; we replace the specified path after "-Djava.library.path=". I hope you don't have any spaces in there, I'm not good with regular expressions (that's what the "[a-zA-Z0-9_/\.-]+"-thingy is called).
echo $ARGS > /tmp/args_modified
: Uncomment this line if you want to see what we get after our modifications to ARGS. This can be useful for finding out what you got wrong in the paths. (I needed this very often for the regex ^^)
$JAVA $ARGS
: Call the version of Java we specified at the top and pass the modified arguments of the MC-Launcher to it.
Making the Launcher run our wrapper
Launch the MC-Launcher, log in (if needed) and edit the current profile: In the section "Java Settings (Advanced)" check the option "Executable" and change the path to our Java-wrapper-script.
Now it's finally time to test our wrapper! Launch the MC-Launcher and start minecraft as usual. That's it! If it doesn't work you'll get a few error messages which will hopefully explain what's wrong... You then may need to change a few paths. (Let's hope it's not more than that.) And if it works: Have Fun!
Feel free to ask anything, in some cases I may be able to provide an answer - if not I hope that someone else can.