Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starting Minecraft older than 1.19 crashes on Apple Silicon #170

Open
JXSnack opened this issue Aug 20, 2023 · 21 comments
Open

Starting Minecraft older than 1.19 crashes on Apple Silicon #170

JXSnack opened this issue Aug 20, 2023 · 21 comments
Assignees
Labels
api This issue is related to the API or its implementation enhancement New feature or request

Comments

@JXSnack
Copy link

JXSnack commented Aug 20, 2023

My code

from portablemc.standard import Version
Version("1.12.2").install().run()

Crashes with

Traceback (most recent call last):
  File "/Users/joram/PycharmProjects/EastShoreLauncher/portablemc/standard.py", line 851, in _resolve_jvm
    with jvm_manifest_file.open("rt") as jvm_manifest_fp:
  File "/opt/homebrew/Cellar/python@3.10/3.10.12_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/pathlib.py", line 1119, in open
    return self._accessor.open(self, mode, buffering, encoding, errors,
FileNotFoundError: [Errno 2] No such file or directory: '/Users/joram/Library/Application Support/minecraft/jvm/jre-legacy.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/joram/PycharmProjects/EastShoreLauncher/portablemc/standard.py", line 930, in _resolve_builtin_jvm
    version_start = stdout.index(f"1.{major_version}" if major_version <= 8 else str(major_version))
ValueError: substring not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/joram/PycharmProjects/EastShoreLauncher/main.py", line 2, in <module>
    Version("1.12.2").install().run()
  File "/Users/joram/PycharmProjects/EastShoreLauncher/portablemc/standard.py", line 316, in install
    self._resolve_jvm(watcher)  # JVM added here on purpose to ease implementation of ForgeVersion
  File "/Users/joram/PycharmProjects/EastShoreLauncher/portablemc/standard.py", line 865, in _resolve_jvm
    return self._resolve_builtin_jvm(watcher, JvmNotFoundError.UNSUPPORTED_VERSION, jvm_major_version)
  File "/Users/joram/PycharmProjects/EastShoreLauncher/portablemc/standard.py", line 943, in _resolve_builtin_jvm
    raise JvmNotFoundError(JvmNotFoundError.BUILTIN_INVALID_VERSION)
portablemc.standard.JvmNotFoundError: 'builtin_invalid_version'

If I understand this correctly, it can't find the correct JVM. I tried using Zulu-8, so I tried this

portablemc start 1.12.2 --jvm /Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/bin/java

but it crashed with

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: net/minecraft/client/main/Main has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:757)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:621)
@mindstorm38
Copy link
Owner

Interesting 🤔 You're running on a macOS M1 processor I guess? If so, I think that Mojang doesn't provide a JVM for such system, it's why you are required to specify a java exec path, or let the launcher search for a "built-in" JVM, in your case it appears that its version is wrong for running 1.12.2

For zulu-8, I don't know why it isn't working as 1.12.2 should work with java 8, the main class for 1.12.2 shouldn't be of class file version 1.61. Could you try running the launcher with verbose flag -vv to display the full command line?

@JXSnack
Copy link
Author

JXSnack commented Aug 20, 2023

When I try to execute it with -v or -vv it says portablemc: error: unrecognized arguments: -v. Did I do something wrong?

@mindstorm38
Copy link
Owner

The verbose flag need to be put before the sub command portablemc -vv start ...

@mindstorm38 mindstorm38 self-assigned this Aug 20, 2023
@mindstorm38 mindstorm38 added bug Something isn't working api This issue is related to the API or its implementation labels Aug 20, 2023
@JXSnack
Copy link
Author

JXSnack commented Aug 20, 2023

Okay, here's the output, I have hidden my email for security purposes.

(venv) joram@joram-mini EastShoreLauncher % portablemc -vv start 1.12.2 -l *@*.de --auth-anonymize --jvm /Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/bin/java 
[  OK  ] Session validated for j***m@k*******p.de           
[  OK  ] Loaded version 1.12.2     
[  OK  ] Loaded custom java 
[  OK  ] Checked version jar
[  OK  ] Checked 1305 assets version 1.12
[  OK  ] Checked 32 class and 3 native libraries
[  OK  ] Using logger client-1.12

/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/bin/java -XstartOnFirstThread -Djava.library.path=/Users/joram/Library/Application Support/minecraft/bin/81f27280-e9e0-4b3c-8026-4db960d12336 -Dminecraft.launcher.brand=portablemc -Dminecraft.launcher.version=4.0.1 -cp /Users/joram/Library/Application Support/minecraft/versions/1.12.2/1.12.2.jar:/Users/joram/Library/Application Support/minecraft/libraries/com/mojang/patchy/1.3.9/patchy-1.3.9.jar:/Users/joram/Library/Application Support/minecraft/libraries/oshi-project/oshi-core/1.1/oshi-core-1.1.jar:/Users/joram/Library/Application Support/minecraft/libraries/net/java/dev/jna/jna/4.4.0/jna-4.4.0.jar:/Users/joram/Library/Application Support/minecraft/libraries/net/java/dev/jna/platform/3.4.0/platform-3.4.0.jar:/Users/joram/Library/Application Support/minecraft/libraries/com/ibm/icu/icu4j-core-mojang/51.2/icu4j-core-mojang-51.2.jar:/Users/joram/Library/Application Support/minecraft/libraries/net/sf/jopt-simple/jopt-simple/5.0.3/jopt-simple-5.0.3.jar:/Users/joram/Library/Application Support/minecraft/libraries/com/paulscode/codecjorbis/20101023/codecjorbis-20101023.jar:/Users/joram/Library/Application Support/minecraft/libraries/com/paulscode/codecwav/20101023/codecwav-20101023.jar:/Users/joram/Library/Application Support/minecraft/libraries/com/paulscode/libraryjavasound/20101123/libraryjavasound-20101123.jar:/Users/joram/Library/Application Support/minecraft/libraries/com/paulscode/librarylwjglopenal/20100824/librarylwjglopenal-20100824.jar:/Users/joram/Library/Application Support/minecraft/libraries/com/paulscode/soundsystem/20120107/soundsystem-20120107.jar:/Users/joram/Library/Application Support/minecraft/libraries/io/netty/netty-all/4.1.9.Final/netty-all-4.1.9.Final.jar:/Users/joram/Library/Application Support/minecraft/libraries/com/google/guava/guava/21.0/guava-21.0.jar:/Users/joram/Library/Application Support/minecraft/libraries/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar:/Users/joram/Library/Application Support/minecraft/libraries/commons-io/commons-io/2.5/commons-io-2.5.jar:/Users/joram/Library/Application Support/minecraft/libraries/commons-codec/commons-codec/1.10/commons-codec-1.10.jar:/Users/joram/Library/Application Support/minecraft/libraries/net/java/jinput/jinput/2.0.5/jinput-2.0.5.jar:/Users/joram/Library/Application Support/minecraft/libraries/net/java/jutils/jutils/1.0.0/jutils-1.0.0.jar:/Users/joram/Library/Application Support/minecraft/libraries/com/google/code/gson/gson/2.8.0/gson-2.8.0.jar:/Users/joram/Library/Application Support/minecraft/libraries/com/mojang/authlib/1.5.25/authlib-1.5.25.jar:/Users/joram/Library/Application Support/minecraft/libraries/com/mojang/realms/1.10.22/realms-1.10.22.jar:/Users/joram/Library/Application Support/minecraft/libraries/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar:/Users/joram/Library/Application Support/minecraft/libraries/org/apache/httpcomponents/httpclient/4.3.3/httpclient-4.3.3.jar:/Users/joram/Library/Application Support/minecraft/libraries/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar:/Users/joram/Library/Application Support/minecraft/libraries/org/apache/httpcomponents/httpcore/4.3.2/httpcore-4.3.2.jar:/Users/joram/Library/Application Support/minecraft/libraries/it/unimi/dsi/fastutil/7.1.0/fastutil-7.1.0.jar:/Users/joram/Library/Application Support/minecraft/libraries/org/apache/logging/log4j/log4j-api/2.8.1/log4j-api-2.8.1.jar:/Users/joram/Library/Application Support/minecraft/libraries/org/apache/logging/log4j/log4j-core/2.8.1/log4j-core-2.8.1.jar:/Users/joram/Library/Application Support/minecraft/libraries/org/lwjgl/lwjgl/lwjgl/2.9.2-nightly-20140822/lwjgl-2.9.2-nightly-20140822.jar:/Users/joram/Library/Application Support/minecraft/libraries/org/lwjgl/lwjgl/lwjgl_util/2.9.2-nightly-20140822/lwjgl_util-2.9.2-nightly-20140822.jar:/Users/joram/Library/Application Support/minecraft/libraries/com/mojang/text2speech/1.10.3/text2speech-1.10.3.jar:/Users/joram/Library/Application Support/minecraft/libraries/ca/weblite/java-objc-bridge/1.0.0/java-objc-bridge-1.0.0.jar -Dlog4j.configurationFile=/Users/joram/Library/Application Support/minecraft/assets/log_configs/client-1.12.xml -Xmx2G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M net.minecraft.client.main.Main --username JX_Snack --version 1.12.2 --gameDir /Users/joram/Library/Application Support/minecraft --assetsDir /Users/joram/Library/Application Support/minecraft/assets --assetIndex 1.12 --uuid 93f972e8d67c44308dd0919117c44206 --accessToken eyJraWQiOiJhYzg0YSIsImFsZyI6IkhTMjU2In0.eyJ4dWlkIjoiMjUzNTQ2MjYwMjgzNjUyMyIsImFnZyI6IkFkdWx0Iiwic3ViIjoiN2Q3ZmMyZmQtODA4Yy00NWNkLWJmY2UtNjY5N2FhMDcyYjU1IiwiYXV0aCI6IlhCT1giLCJucyI6ImRlZmF1bHQiLCJyb2xlcyI6W10sImlzcyI6ImF1dGhlbnRpY2F0aW9uIiwiZmxhZ3MiOlsidHdvZmFjdG9yYXV0aCIsIm9yZGVyc18yMDIyIl0sInBsYXRmb3JtIjoiVU5LTk9XTiIsInl1aWQiOiI2OGQyMTlkYmE5NTcwZGIwZmY4ZGRhMzg5ZjBkM2Q4OSIsIm5iZiI6MTY5MjUzMDE4NywiZXhwIjoxNjkyNjE2NTg3LCJpYXQiOjE2OTI1MzAxODd9.teP22FmEuERxts8YOpwDRrpueRaUI_vq1rgIxD41PJ0 --userType msa --versionType release
Exception in thread "main" java.lang.UnsatisfiedLinkError: /Users/joram/Library/Application Support/minecraft/bin/81f27280-e9e0-4b3c-8026-4db960d12336/liblwjgl.dylib: dlopen(/Users/joram/Library/Application Support/minecraft/bin/81f27280-e9e0-4b3c-8026-4db960d12336/liblwjgl.dylib, 0x0001): tried: '/Users/joram/Library/Application Support/minecraft/bin/81f27280-e9e0-4b3c-8026-4db960d12336/liblwjgl.dylib' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/joram/Library/Application Support/minecraft/bin/81f27280-e9e0-4b3c-8026-4db960d12336/liblwjgl.dylib' (no such file), '/Users/joram/Library/Application Support/minecraft/bin/81f27280-e9e0-4b3c-8026-4db960d12336/liblwjgl.dylib' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64'))
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1950)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1865)
        at java.lang.Runtime.loadLibrary0(Runtime.java:844)
        at java.lang.System.loadLibrary(System.java:1136)
        at org.lwjgl.Sys$1.run(Sys.java:73)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
        at org.lwjgl.Sys.loadLibrary(Sys.java:95)
        at org.lwjgl.Sys.<clinit>(Sys.java:112)
        at bib.I(SourceFile:2825)
        at net.minecraft.client.main.Main.main(SourceFile:38)

@Ristovski
Copy link
Contributor

Ristovski commented Aug 20, 2023

(have 'i386,x86_64', need 'arm64')

Can you try launching with --lwjgl 3.2.3? (if it still doesn't work, try different versions mentioned in https://github.com/mindstorm38/portablemc#lwjgl-version-and-arm-support)

@mindstorm38
Copy link
Owner

mindstorm38 commented Aug 20, 2023

Wow, this doesn't look good at all! I'm afraid that the problem come from your Apple M1 chip, because Mojang were not supporting Apple M1 until 1.19.

Moreover, Minecraft 1.12.2 is depending on LWJGL 2.9, which is a legacy version of LWJGL which is really complicated to work with other architectures. If the LWJGL version was 3.3.0 (minimum), it would've been possible to support M1 using the --lwjgl argument, but sadly I'm currently not able to run 2.9 versions with Apple M1.

However, if you find someone with an LWJGL 2.9 port for M1, I would happily implement 2.9 to the --lwjgl argument.

(@Ristovski 's answer appeared while writing this, but I think his answer won't work because LWJGL 2.9 and 3.3 APIs are incompatible)

@JXSnack
Copy link
Author

JXSnack commented Aug 20, 2023

Still getting the same error. I checked lwjgl 3.2.3, 3.3.0, 3.3.1 and 3.3.2

@JXSnack
Copy link
Author

JXSnack commented Aug 20, 2023

Wow, this doesn't look good at all! I'm afraid that the problem come from your Apple M1 chip, because Mojang were not supporting Apple M1 until 1.19.

Moreover, Minecraft 1.12.2 is depending on LWJGL 2.9, which is a legacy version of LWJGL which is really complicated to work with other architectures. If the LWJGL version was 3.3.0 (minimum), it would've been possible to support M1 using the --lwjgl argument, but sadly I'm currently not able to run 2.9 versions with Apple M1.

However, if you find someone with an LWJGL 2.9 port for M1, I would happily implement 2.9 to the --lwjgl argument.

(@Ristovski 's answer appeared while writing this, but I think his answer won't work because LWJGL 2.9 and 3.3 APIs are incompatible)

oh, that's sad.

@mindstorm38
Copy link
Owner

This article looks interesting: https://shadowfacts.net/2022/lwjgl-arm64/
I would be very happy to natively support LWJGL 2.9 on Apple Silicon, I came back to you if I find any viable fix to this.

@JXSnack
Copy link
Author

JXSnack commented Aug 20, 2023

Okay, because I just wanted to ask how mojang starts Minecraft 1.12.2 on Apple M1 if it's not supported.

@mindstorm38
Copy link
Owner

The official launcher make it works?

@JXSnack
Copy link
Author

JXSnack commented Aug 20, 2023

yeah

@JXSnack
Copy link
Author

JXSnack commented Aug 20, 2023

Prism Launcher, MultiMC, etc. also work

@Ristovski
Copy link
Contributor

Are you sure those are not simply using the Rosetta x86 -> arm64 binary translation present on M1 Macs?

@mindstorm38 mindstorm38 changed the title Starting Minecraft older than 1.19 crashes Starting Minecraft older than 1.19 crashes on Apple Silicon Aug 20, 2023
@JXSnack
Copy link
Author

JXSnack commented Aug 21, 2023

I have no idea. Could be, but even if so I would have no idea on how to implement that. (I know Python but I have no experience with that)

@JXSnack
Copy link
Author

JXSnack commented Aug 21, 2023

So, how can we fix this issue?

@mindstorm38
Copy link
Owner

mindstorm38 commented Aug 21, 2023

No update on my side, I need to get my hands on an Apple Silicon (should be possible soon) to really understand what's going on!

PS: If anyone knows a M1 emulator, I'm also happy :)

@Ristovski
Copy link
Contributor

Ristovski commented Aug 22, 2023

According to the Zulu JVM, there should have been a prompt to install Rosetta 2 when installing Zulu.

Can you check if it is indeed installed by running the following in a Terminal: /usr/bin/pgrep -q oahd && echo Yes || echo No? (from what I could gather, that process being present is indication that Rosetta is installed).

I assume that with Rosetta 2 installed, Zulu should be able to run x86 libglfw and others on Apple silicon.

@JXSnack
Copy link
Author

JXSnack commented Aug 22, 2023

It's responding with Yes

@Ristovski
Copy link
Contributor

Hmm, quite weird then. Sadly, I am out of ideas as to why it is not working in that case.

@mindstorm38 mindstorm38 added enhancement New feature or request and removed bug Something isn't working labels Aug 23, 2023
@mindstorm38
Copy link
Owner

Categorized this to enhancement because it's more related to supporting Mojang's flaws, the launcher itself is not bugged. I'll also release the second patch soon so this will not be directly included in it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api This issue is related to the API or its implementation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants