LWJGL/lwjgl3

lwjgl-*-natives-macos-arm64:3.3.2 Failed to locate library: liblwjgl.dylib [in thread "Render thread"]

runlevel5 opened this issue · 6 comments

Version

3.3.2

Platform

macOS arm64

JDK

OpenJDK Runtime Environment Temurin-17.0.7+7 (build 17.0.7+7)

Module

LWJGL core

Bug description

The Minecraft 1.20.2 uses following modules:

  • org.lwjgl:lwjgl-glfw-natives-macos-arm64:3.3.2
  • org.lwjgl:lwjgl-jemalloc-natives-macos-arm64:3.3.2
  • org.lwjgl:lwjgl-natives-macos-arm64:3.3.2
  • org.lwjgl:lwjgl-openal-natives-macos-arm64:3.3.2
  • org.lwjgl:lwjgl-opengl-natives-macos-arm64:3.3.2
  • org.lwjgl:lwjgl-stb-natives-macos-arm64:3.3.2
  • org.lwjgl:lwjgl-tinyfd-natives-macos-arm64:3.3.2

NOTE: The JAR files are downloaded from minecraft server https://libraries.minecraft.net/org/lwjgl/lwjgl-<NAME>/3.3.2/. So I am unsure if they are exactly the same to the official JAR https://libraries.io/maven/org.lwjgl:lwjgl/3.3.2

when I try to run it, I got following error:

Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.UnsatisfiedLinkError: Failed to locate library: liblwjgl.dylib [in thread "Render thread"]

The games run fine with v3.3.1 and so I could conclude the issue is definitely caused by 3.3.2

Stacktrace or crash log output

PolyMC version: 5.1


Launched instance in offline mode

Minecraft folder is:
/Users/tle/Library/Application Support/PolyMC/instances/1.20.2/.minecraft


Java path is:
/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home/bin/java


Checking Java version...
Java is version 17.0.7, using 64 (aarch64) architecture, from Eclipse Adoptium.


Main Class:
  net.minecraft.client.main.Main

Native path:
  /Users/tle/Library/Application Support/PolyMC/instances/1.20.2/natives

Traits:
traits XR:Initial
traits FirstThreadOnMacOS

Libraries:
  /Users/tle/Library/Application Support/PolyMC/libraries/org/lwjgl/lwjgl-glfw/3.3.2/lwjgl-glfw-3.3.2.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/org/lwjgl/lwjgl-jemalloc/3.3.2/lwjgl-jemalloc-3.3.2.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/org/lwjgl/lwjgl-openal/3.3.2/lwjgl-openal-3.3.2.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/org/lwjgl/lwjgl-opengl/3.3.2/lwjgl-opengl-3.3.2.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/org/lwjgl/lwjgl-stb/3.3.2/lwjgl-stb-3.3.2.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/org/lwjgl/lwjgl-tinyfd/3.3.2/lwjgl-tinyfd-3.3.2.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/org/lwjgl/lwjgl/3.3.2/lwjgl-3.3.2.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/ca/weblite/java-objc-bridge/1.1/java-objc-bridge-1.1.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/com/github/oshi/oshi-core/6.4.5/oshi-core-6.4.5.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/com/google/code/gson/gson/2.10.1/gson-2.10.1.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/com/google/guava/guava/32.1.2-jre/guava-32.1.2-jre.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/com/ibm/icu/icu4j/73.2/icu4j-73.2.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/com/mojang/authlib/5.0.47/authlib-5.0.47.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/com/mojang/blocklist/1.0.10/blocklist-1.0.10.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/com/mojang/brigadier/1.1.8/brigadier-1.1.8.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/com/mojang/datafixerupper/6.0.8/datafixerupper-6.0.8.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/com/mojang/logging/1.1.1/logging-1.1.1.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/com/mojang/patchy/2.2.10/patchy-2.2.10.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/com/mojang/text2speech/1.17.9/text2speech-1.17.9.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/commons-codec/commons-codec/1.16.0/commons-codec-1.16.0.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/commons-io/commons-io/2.13.0/commons-io-2.13.0.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/commons-logging/commons-logging/1.2/commons-logging-1.2.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/io/netty/netty-buffer/4.1.97.Final/netty-buffer-4.1.97.Final.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/io/netty/netty-codec/4.1.97.Final/netty-codec-4.1.97.Final.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/io/netty/netty-common/4.1.97.Final/netty-common-4.1.97.Final.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/io/netty/netty-handler/4.1.97.Final/netty-handler-4.1.97.Final.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/io/netty/netty-resolver/4.1.97.Final/netty-resolver-4.1.97.Final.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/io/netty/netty-transport-classes-epoll/4.1.97.Final/netty-transport-classes-epoll-4.1.97.Final.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/io/netty/netty-transport-native-unix-common/4.1.97.Final/netty-transport-native-unix-common-4.1.97.Final.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/io/netty/netty-transport/4.1.97.Final/netty-transport-4.1.97.Final.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/it/unimi/dsi/fastutil/8.5.12/fastutil-8.5.12.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/net/java/dev/jna/jna-platform/5.13.0/jna-platform-5.13.0.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/net/java/dev/jna/jna/5.13.0/jna-5.13.0.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/net/sf/jopt-simple/jopt-simple/5.0.4/jopt-simple-5.0.4.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/org/apache/commons/commons-compress/1.22/commons-compress-1.22.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/org/apache/commons/commons-lang3/3.13.0/commons-lang3-3.13.0.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/org/apache/httpcomponents/httpcore/4.4.16/httpcore-4.4.16.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/org/apache/logging/log4j/log4j-api/2.19.0/log4j-api-2.19.0.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/org/apache/logging/log4j/log4j-core/2.19.0/log4j-core-2.19.0.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/org/apache/logging/log4j/log4j-slf4j2-impl/2.19.0/log4j-slf4j2-impl-2.19.0.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/org/joml/joml/1.10.5/joml-1.10.5.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/org/slf4j/slf4j-api/2.0.7/slf4j-api-2.0.7.jar
  /Users/tle/Library/Application Support/PolyMC/libraries/com/mojang/minecraft/1.20.2/minecraft-1.20.2-client.jar

Native libraries:

Params:
  --username  --version 1.20.2 --gameDir /Users/tle/Library/Application Support/PolyMC/instances/1.20.2/.minecraft --assetsDir /Users/tle/Library/Application Support/PolyMC/assets --assetIndex 8 --uuid  --accessToken  --userType  --versionType release

Window size: 854 x 480

Java Arguments:
[-Xdock:icon=icon.png, -Xdock:name="PolyMC: 1.20.2", -XstartOnFirstThread, -Xms512m, -Xmx4096m, -Duser.language=en]


Minecraft process ID: 14906


[23:47:28] [Datafixer Bootstrap/INFO]: 192 Datafixer optimizations took 57 milliseconds
[LWJGL] Failed to load a library. Possible solutions:
	a) Add the directory that contains the shared library to -Djava.library.path or -Dorg.lwjgl.librarypath.
	b) Add the JAR that contains the shared library to the classpath.
[LWJGL] Enable debug mode with -Dorg.lwjgl.util.Debug=true for better diagnostics.
[LWJGL] Enable the SharedLibraryLoader debug mode with -Dorg.lwjgl.util.DebugLoader=true for better diagnostics.
Sept 27, 2023 11:47:29 PM org.polymc.EntryPoint listen
SEVERE: Exception caught from launcher.
java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.polymc.impl.OneSixLauncher.invokeMain(OneSixLauncher.java:104)
	at org.polymc.impl.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:176)
	at org.polymc.impl.OneSixLauncher.launch(OneSixLauncher.java:186)
	at org.polymc.EntryPoint.listen(EntryPoint.java:144)
	at org.polymc.EntryPoint.main(EntryPoint.java:74)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.mojang.blaze3d.systems.RenderSystem
	at ab.a(SourceFile:66)
	at eqv.a(SourceFile:2500)
	at eqv.a(SourceFile:2494)
	at net.minecraft.client.main.Main.main(SourceFile:223)
	... 9 more
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.UnsatisfiedLinkError: Failed to locate library: liblwjgl.dylib [in thread "Render thread"]
	at org.lwjgl.system.Library.loadSystem(Library.java:174)
	at org.lwjgl.system.Library.loadSystem(Library.java:64)
	at org.lwjgl.system.Library.<clinit>(Library.java:52)
	at org.lwjgl.system.MemoryUtil.<clinit>(MemoryUtil.java:100)
	at ekn.<clinit>(SourceFile:8)
	at elk.<init>(SourceFile:48)
	at elr.<init>(SourceFile:19)
	at elr.<init>(SourceFile:23)
	at elr.<clinit>(SourceFile:11)
	at com.mojang.blaze3d.systems.RenderSystem.<clinit>(SourceFile:50)
	at net.minecraft.client.main.Main.main(SourceFile:211)
	... 9 more
Sept 27, 2023 11:47:29 PM org.polymc.EntryPoint main
INFO: Exiting with 1

Hi @runlevel5, what are the contents of /Users/tle/Library/Application Support/PolyMC/instances/1.20.2/natives?

I'm not familiar with the launcher but since there are no entries under the Native libraries: section, this looks like a PolyMC issue.

Hi @runlevel5, what are the contents of /Users/tle/Library/Application Support/PolyMC/instances/1.20.2/natives?

There is no such folder.

I've reported the bug with PolyMC and waiting for their responses.

@TheMrMilchmann I believe this issue might be related to the JAR that upstream Mojang (Minecraft company) is using.

I would like to ask where I could download the official JARs? I could try to compare the checksum to confirm if Mojang employs the same packages or build everything from scratches themselves.

You can find official builds on Maven Central. However, I doubt that Mojang modifies them in any relevant way.

You are facing the error because LWJGL cannot load shared native libraries. LWJGL can load these in various ways and the logs are a bit lacking but here is what I believe is happening: In your message, you stated that Minecraft uses the org.lwjgl:lwjgl-{binding}-natives-macos-arm64:3.3.2 artifacts, but those are not mentioned anywhere in the logs. While LWJGL can load native libraries from JARs at runtime, the preferred way is to extract them to directories. This is where the /Users/tle/Library/Application Support/PolyMC/instances/1.20.2/natives directory comes in. However, for some reason, your launcher fails to extract the shared libraries properly. Thus, the directory is empty and LWJGL cannot find any natives.

If you want to work around this issue, you could try extracting the dylibs into the specified directory yourself or adding the natives-macos-arm64 artifacts to the list of libraries.

@TheMrMilchmann Great thanks for the advice. Let me dig in and come back to you

@TheMrMilchmann it is definitely the issue of PolyMC. I am closing this ticket now.