NixOS/nixpkgs

mindustry-wayland crashes

Closed this issue · 6 comments

Describe the bug

mindustry-wayland crashes when launched

Steps To Reproduce

Simple run mindustry-wayland.

Expected behavior

Should launch the game.

Screenshots

[E] Failed to initialize discord. Enable debug logging for details.
[E] java.lang.ExceptionInInitializerError
	at arc.backend.sdl.SdlGL20.glGetString(SdlGL20.java:36)
	at arc.backend.sdl.SdlGraphics.<init>(SdlGraphics.java:37)
	at arc.backend.sdl.SdlApplication.<init>(SdlApplication.java:34)
	at mindustry.desktop.DesktopLauncher.main(DesktopLauncher.java:36)
Caused by: arc.util.ArcRuntimeException: GLEW failed to initialize: Missing GL version
	at arc.backend.sdl.jni.SDLGL.<clinit>(SDLGL.java:109)
	... 4 more

[E] Failed to save local crash report.: java.lang.NullPointerException: Cannot invoke "mindustry.mod.Mods.list()" because "mindustry.Vars.mods" is null
	at mindustry.net.CrashSender.createReport(CrashSender.java:29)
	at mindustry.net.CrashSender.send(CrashSender.java:92)
	at mindustry.desktop.DesktopLauncher.handleCrash(DesktopLauncher.java:186)
	at mindustry.desktop.DesktopLauncher.main(DesktopLauncher.java:44)

[I] Sending crash report.
java.net.ConnectException: Connection refused
	at java.base/sun.nio.ch.Net.pollConnect(Native Method)
	at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:660)
	at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:549)
	at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597)
	at java.base/java.net.Socket.connect(Socket.java:648)
	at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:177)
	at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:474)
	at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:569)
	at java.base/sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
	at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:341)
	at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:362)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1261)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1194)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1082)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1016)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1375)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1350)
	at arc.util.NetJavaImpl.lambda$http$0(NetJavaImpl.java:67)
	at arc.util.async.AsyncExecutor.lambda$submit$2(AsyncExecutor.java:32)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
	at java.base/java.lang.Thread.run(Thread.java:832)

Additional context

I am using a minimal installation of sway.

Notify maintainers

@fgaz

Metadata

 - system: `"x86_64-linux"`
 - host os: `Linux 5.15.75, NixOS, 22.11 (Raccoon), 22.11.20221029.7f9be6a`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.11.0`
 - channels(root): `"nixos"`
 - channels(null): `"nixos"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos

I should also note that then normally non-wayland output works fine.

chkno commented

( Some history: Anuken/Mindustry#1393 )

I don't think this problem is related to how mindustry is packaged in nixpkgs. I think this is just a bug in Mindustry / Arc. Mindustry calls glewInit() in a static initializer block in Arc/backends/backend-sdl/src/arc/backend/sdl/jni/SDLGL.java. This is way too early! glewInit() should be called after the GL rendering context is created.

Moving the glewInit call to SdlGraphics' constructor appears to fix the problem.

chkno commented

I created upstream issue Anuken/Arc#131

dryya commented

This issue can be closed, mindustry-wayland is working fine on 22.11 and up.

The issue was fixed in Arc commit Anuken/Arc@81877c5, which was released in version 141, and nixpkgs updated to it in #210628.

fgaz commented

Thanks everyone!