Mindustry: Fails to launch on Mac 10.13

Created on 22 Mar 2018  Â·  13Comments  Â·  Source: Anuken/Mindustry

Getting the following errors w/ both 3.4 stable and a build off of master:
[(⎈ |docker-for-desktop:default) (master)] $ java -jar desktop/build/libs/desktop-release.jar Error in LSRegisterURL: -10811 java.lang.ExceptionInInitializerError at org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:1647) at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createGlfwWindow(Lwjgl3Application.java:442) at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createWindow(Lwjgl3Application.java:391) at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createWindow(Lwjgl3Application.java:379) at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:108) at io.anuke.mindustry.desktop.DesktopLauncher.main(DesktopLauncher.java:27) Caused by: java.lang.IllegalStateException: GLFW windows may only be created on the main thread and that thread must be the first thread in the process. Please run the JVM with -XstartOnFirstThread. For offscreen rendering, make sure another window toolkit (e.g. AWT or JavaFX) is initialized before GLFW. at org.lwjgl.glfw.EventLoop$OffScreen.<clinit>(EventLoop.java:37) ... 6 more Disposed server. 2018-03-22 06:22:34.123 java[41268:1588630] !!! BUG: The current event queue and the main event queue are not the same. Events will not be handled correctly. This is probably because _TSGetMainThread was called for the first time off the main thread. ^CAL lib: (EE) alc_cleanup: 1 device not closed (sauce) skeenan@Shaun-Keenan-SL0256 ~/git/tools/Mindustry [(⎈ |docker-for-desktop:default) (master)] $ java -XstartOnFirstThread -jar desktop/build/libs/desktop-release.jar Error in LSRegisterURL: -10811 Got locale: en_US Total blocks loaded: 96 Failed to find custom map directory. Controllers: added manager for application, 1 managers active 1111 java(41276,0x7fff8eb75340) malloc: *** error for object 0x133284160: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug Abort trap: 6

Most helpful comment

Looks like I missed that part. As @TheChosenEvilOne said, this seems to be an error with GLFW or LWJGL. Regardless of the cause, I doubt I'll be able to fix anything with an error message that incomprehensible, unless someone else has had the exact same problem.

All 13 comments

This issue is caused by libgdx and LightWeight Java Graphics Library (LWJGL)
NOT Mindustry

As the message says, you need to run it with the JVM argument -XstartOnFirstThread.

They started it with that argument, but still got an error.

Looks like I missed that part. As @TheChosenEvilOne said, this seems to be an error with GLFW or LWJGL. Regardless of the cause, I doubt I'll be able to fix anything with an error message that incomprehensible, unless someone else has had the exact same problem.

Should be able to add "XstartOnFirstThread" to "vmargs" in packr.
(note the - is not needed when set in "vmargs")

Without -XstartOnFirstThread I get this on my Mac:

Samwise:Resources jeremy$ pwd
/Users/jeremy/Downloads/Mindustry.app/Contents/Resources
Samwise:Resources jeremy$ ls -al
total 47056
drwxr-xr-x@ 8 jeremy  staff       272 22 Apr 13:08 .
drwxr-xr-x@ 5 jeremy  staff       170  2 Apr 14:29 ..
-rw-r--r--@ 1 jeremy  staff       157  2 Apr 14:29 config.json
-rw-r--r--@ 1 jeremy  staff  24076660  2 Apr 14:29 desktop-release.jar
-rw-r--r--@ 1 jeremy  staff      4990  2 Apr 14:29 icons.icns
drwxr-xr-x@ 7 jeremy  staff       238  2 Apr 14:29 jre
drwxr-xr-x  3 jeremy  staff       102 22 Apr 10:08 mindustry-maps
drwxr-xr-x  4 jeremy  staff       136 22 Apr 10:20 mindustry-saves
Samwise:Resources jeremy$ java  -jar desktop-release.jar
Error in LSRegisterURL: -10811
java.lang.ExceptionInInitializerError
    at org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:1647)
    at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createGlfwWindow(Lwjgl3Application.java:442)
    at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createWindow(Lwjgl3Application.java:391)
    at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createWindow(Lwjgl3Application.java:379)
    at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:108)
    at io.anuke.mindustry.desktop.DesktopLauncher.main(DesktopLauncher.java:27)
Caused by: java.lang.IllegalStateException: GLFW windows may only be created on the main thread and that thread must be the first thread in the process. Please run the JVM with -XstartOnFirstThread. For offscreen rendering, make sure another window toolkit (e.g. AWT or JavaFX) is initialized before GLFW.
    at org.lwjgl.glfw.EventLoop$OffScreen.<clinit>(EventLoop.java:37)
    ... 6 more
Disposed server.
2018-04-22 13:08:53.998 java[11714:1710565] !!! BUG: The current event queue and the main event queue are not the same. Events will not be handled correctly. This is probably because _TSGetMainThread was called for the first time off the main thread.
^CAL lib: (EE) alc_cleanup: 1 device not closed

With -XstartOnFirstThread it works:

Samwise:Resources jeremy$ java -XstartOnFirstThread -jar desktop-release.jar
Error in LSRegisterURL: -10811
Got locale: en_AU
Total blocks loaded: 96
Controllers: added manager for application, 1 managers active

XstartOnFirstThread has always been in the VM args for packr, although with an extra '-' at the start.
However, I've heard that people have been able to run those versions on Mac anyway, so I don't think the extra hyphen has every been an issue, at least for some people (?).

Some extra info: I downgraded the JDK version on my mac from 8u171 to 8u60 and it runs fine now just double-clicking the app.

That's strange though because the app should be using the JRE inside the package so the installed version on the Mac shouldn't matter.

What if you uninstall the JDK and JRE altogether?

Yep - works without a JDK or JRE installed.

So I just installed 8u172 and it works fine now. I don't know what to make of that!

Perhaps it automatically uses the installed JDK if it finds one, and falls back on the bundled one?

I don't know. I can't reproduce the problem at all now that I've reinstalled Java on my Mac.

I've gotten a Mac now, and the newest version has been confirmed working on version 10.13 even without a JDK installed. The JVM argument issue has been fixed as well.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

summetdev picture summetdev  Â·  3Comments

genii11 picture genii11  Â·  4Comments

P
Ciaran876 picture Ciaran876  Â·  3Comments

BorisA11 picture BorisA11  Â·  3Comments

zabzabzab picture zabzabzab  Â·  3Comments