godot-kotlin-jvm
godot-kotlin-jvm copied to clipboard
[Export/OSX]JRE is not well embedded
Currently OSX export is buggy.
It generates a dmg
, with a jre
folder side to it.
This cause trouble because app cannot find jre
folder:
**WARNING**: Godot-JVM: Godot-JVM: No embedded jvm found on path: jre/lib/server/libjvm.dylib!
At: modules/kotlin_jvm/src/jni/jvm_loader.cpp:59:get_jvm_lib_path() - Godot-JVM: Godot-JVM: No embedded jvm found on path: jre/lib/server/libjvm.dylib!
**WARNING**: Godot-JVM: Godot-JVM: You really should embedd a jre in your game with jlink! See the documentation if you don't know how to do that
At: modules/kotlin_jvm/src/jni/jvm_loader.cpp:61:get_jvm_lib_path() - Godot-JVM: Godot-JVM: You really should embedd a jre in your game with jlink! See the documentation if you don't know how to do that
Also, speaking of OSX, with silicon we should be able to make universal application, so that application runs as well on arm or intel. This would need to embbed two jre
in export.
I've done a little experimentation, and I've discovered some workarounds to get the app to still run, despite these limitations.
- First, in the Godot export, you need to disable the hardened runtime in the code signature section. This is crucial because the Hardened Runtime does not allow relative loading of dynamically linked libraries for some reason.
- You need to run the game from the Terminal and make sure you're in the directory where the
jre
folder exists to be able to run it. As an example, if you exported Overnight Kotlin Game.app to your Downloads folder (thejre
folder should also be here):
cd ~/Downloads
./Overnight\ Kotlin\ Game.app/Contents/MacOS/Overnight\ Kotlin\ Game
It opens as expected.
Editor will look at installed jvm using JAVA_HOME
environnent variable. Adding it to bashrc is not enought for running out of terminal. Environnent variable should be added with launchctl
command.
Editor will look at installed jvm using
JAVA_HOME
environnent variable. Adding it to bashrc is not enought for running out of terminal. Environnent variable should be added withlaunchctl
command.
@piiertho Would this affect all JAVA_HOME
variables set this way, or can this be specified with each application in question?
Editor will look at installed jvm using
JAVA_HOME
environnent variable. Adding it to bashrc is not enought for running out of terminal. Environnent variable should be added withlaunchctl
command.@piiertho Would this affect all
JAVA_HOME
variables set this way, or can this be specified with each application in question?
This will affect all apps.
You can modify info.plist to add specific environment variables for app, but I don't recommand to do this way as JAVA_HOME
is meant to be a development workspace setting, like we would do with Android sdk.
Regarding exports, I made more investigations. First hardened runtime can be enabled if jre's dylibs are signed while exporting. But it seems I'm blocked between Godot and hotspot. I explained this here.
@piiertho Can this issue be closed?
Yes, it is fixed.