utopia-rise / godot-kotlin-jvm

Godot Kotlin JVM Module
MIT License
586 stars 39 forks source link

[Export/OSX]JRE is not well embedded #239

Closed piiertho closed 1 year ago

piiertho commented 3 years ago

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.

alicerunsonfedora commented 3 years ago

I've done a little experimentation, and I've discovered some workarounds to get the app to still run, despite these limitations.

cd ~/Downloads
./Overnight\ Kotlin\ Game.app/Contents/MacOS/Overnight\ Kotlin\ Game

It opens as expected.

piiertho commented 3 years ago

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.

alicerunsonfedora commented 3 years ago

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.

@piiertho Would this affect all JAVA_HOME variables set this way, or can this be specified with each application in question?

piiertho commented 3 years ago

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.

@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.

piiertho commented 3 years ago

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.

chippmann commented 1 year ago

@piiertho Can this issue be closed?

piiertho commented 1 year ago

Yes, it is fixed.