Corona-Studio/ProjBobcat

[BUG] Forge 1.16.5 installation error on Mac OS M2.

Closed this issue · 11 comments

Describe the bug
Forge 1.16.5 installation error on Mac OS M2.

ProjBobcat Version
latest

Desktop (please complete the following information):

  • OS: MacOS
  • Processor: M2
  • Version [e.g. 22]

Error log:
[02.06.2024 12:50:27]: MGameUtils: (Stage: Forge Installer) 下载 - log4j-api-2.15.0.jar ( 60 / 63 ) 95,24%
[02.06.2024 12:50:28]: MGameUtils: (Stage: Forge Installer) 下载 - nashorn-core-compat-15.1.1.1.jar ( 61 / 63 ) 96,83%
[02.06.2024 12:50:28]: MGameUtils: (Stage: Forge Installer) 下载 - mixin-0.8.4.jar ( 62 / 63 ) 98,41%
[02.06.2024 12:50:28]: MGameUtils: (Stage: Forge Installer) 下载 - log4j-core-2.15.0.jar ( 63 / 63 ) 100%
[ERROR 02.06.2024 12:50:28]: System.ComponentModel.Win32Exception (8): An error occurred trying to start process '/Applications/Kubiki.app/Contents/Resources/bin/TAIGO.ECore/minecraft/runtime/jre-legacy/bin/java' with working directory '/Applications/Kubiki.app/Contents/Resources/bin/TAIGO.ECore/minecraft'. Exec format error
at System.Diagnostics.Process.ForkAndExecProcess(ProcessStartInfo startInfo, String resolvedFilename, String[] argv, String[] envp, String cwd, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at ProjBobcat.DefaultComponent.Installer.ForgeInstaller.HighVersionForgeInstaller.InstallForgeTaskAsync()
at ProjBobcat.DefaultComponent.Installer.ForgeInstaller.HighVersionForgeInstaller.InstallForgeTaskAsync()
at ProjBobcat.DefaultComponent.Installer.ForgeInstaller.HighVersionForgeInstaller.InstallForgeTaskAsync()
at ProjBobcat.DefaultComponent.Installer.ForgeInstaller.HighVersionForgeInstaller.InstallForgeTaskAsync()

Hmmmm, are you using AArch64 version of JRE to install Forge?

Hi, yes. Java was not for ARM processors. But there was another problem. The liblwjgl.dylib module to be installed in the Natives folder does not support ARM processors when installing Minecraft Forge. How can I fix this error? Newer versions of this module support ARM

Hi, yes. Java was not for ARM processors. But there was another problem. The liblwjgl.dylib module to be installed in the Natives folder does not support ARM processors when installing Minecraft Forge. How can I fix this error? Newer versions of this module support ARM

Probobcat already implemented the solution:

public static List<Library> Replace(List<RawVersionModel> versions, List<Library> libs, NativeReplacementPolicy policy)

However, I still suggest you use the ARM native version of JDK when possible, this will prevent most of the weird errors.

Can you write how to use this method? If you change the Natives policy in VersionLocator, the error remains

This method is not called when the version is received, because if( inherits is {Count > 0} ) is met in the ToVersion (DefaultVersionLocator.cs) method and code execution for changing the natives policy is skipped

Can you write how to use this method? If you change the Natives policy in VersionLocator, the error remains

See

rawLibs = NativeReplaceHelper.Replace([rawVersion, .. inherits ?? []], rawLibs, NativeReplacementPolicy);

This method is not called when the version is received, because if( inherits is {Count > 0} ) is met in the ToVersion (DefaultVersionLocator.cs) method and code execution for changing the natives policy is skipped

Looks like a bug here, I'll look it later. Thx.

Yes, this is a bug. I added a change to the Natives files in this block of code and Minecraft started

I created Pull Request - #154