Closed harmonicsolutions closed 4 years ago
Did you generate the mono glue with the exact same commit/modules? The assemblies used by your editor and your export templates are out of sync.
I did not re-create the editor. I used official Godot mono 3.2 stable for mac. In ubuntu. i created branch from 3.2-stable tag. And I created export templates. export template creation is failed on mac for me. So I used ubuntu to create templates. And I used those templates in the official editor which is Godot mono 3.2 stable for Mac, file: Godot_v3.2-stable_mono_osx.64.zip.
So if i want to use custom export templates in osx editor, do i need to create them by using glue which is generated by osx binary?
if so, kinda mandatory to create editor on mac and templates on the mac right?
If any of the custom modules you added or existing modules that you disabled change the public API, then yes, you need to rebuild the editor too and regenerate the Mono glue for your templates build.
Can you give details on what changes you made in your custom build?
CC @neikeq
I used the commands below to disable all the modules which i do not need for the game. And i ran the commands below on Ubuntu to be able to create Android export templates.
scons -j 6 platform=android --config=force target=release_debug android_arch=armv7 tools=no module_mono_enabled=yes deprecated=no minizip=no builtin_glew=no builtin_libmpcdec=no disable_advanced_gui=yes disable_3d=yes builtin_openssl=no module_openssl_enabled=no module_bmp_enabled=no builtin_libtheora=no builtin_libvorbis=no builtin_opus=no module_bullet_enabled=no module_csg_enabled=no builtin_speex=no builtin_squish=no builtin_zlib=no module_dds_enabled=no module_chibi_enabled=no module_enet_enabled=no module_gdnative_enabled=no module_gridmap_enabled=no module_hdr_enabled=no module_mbedtls_enabled=no module_jpg_enabled=no module_ik_enabled=no module_mobile_vr_enabled=no module_opus_enabled=no module_pvr_enabled=no module_recast_enabled=no module_regex_enabled=no module_squish_enabled=no module_mpc_enabled=no module_tga_enabled=no module_thekla_unwrap_enabled=no module_theora_enabled=no module_tinyexr_enabled=no module_vorbis_enabled=no module_webm_enabled=no module_websocket_enabled=no module_pbm_enabled=no module_speex_enabled=no module_etc_enabled=no mono_prefix=/media/sf_Data/android-armeabi-v7a-release
scons -j 6 platform=android --config=force target=release android_arch=armv7 tools=no module_mono_enabled=yes deprecated=no minizip=no builtin_glew=no builtin_libmpcdec=no disable_advanced_gui=yes disable_3d=yes builtin_openssl=no module_openssl_enabled=no module_bmp_enabled=no builtin_libtheora=no builtin_libvorbis=no builtin_opus=no module_bullet_enabled=no module_csg_enabled=no builtin_speex=no builtin_squish=no builtin_zlib=no module_dds_enabled=no module_chibi_enabled=no module_enet_enabled=no module_gdnative_enabled=no module_gridmap_enabled=no module_hdr_enabled=no module_mbedtls_enabled=no module_jpg_enabled=no module_ik_enabled=no module_mobile_vr_enabled=no module_opus_enabled=no module_pvr_enabled=no module_recast_enabled=no module_regex_enabled=no module_squish_enabled=no module_mpc_enabled=no module_tga_enabled=no module_thekla_unwrap_enabled=no module_theora_enabled=no module_tinyexr_enabled=no module_vorbis_enabled=no module_webm_enabled=no module_websocket_enabled=no module_pbm_enabled=no module_speex_enabled=no module_etc_enabled=no mono_prefix=/media/sf_Data/android-armeabi-v7a-release
It seems that i definitely need to find a way to create Android export template on mac. I can compile Mono glue and Mono editor on mac but when i try to build Android export i got shared lib issue first. Even if i copy required file, then i get the errors below and fails to create Android templates:
cannot find -lpthread cannot find -liconv
I tried so many different things to install these libs into mac but i was not successful. Basically i am stuck on mac. So I created ubuntu image to compile Android exports. I did not face this issue on ubuntu.
This should be possible if done correctly. You may still get the ore API hash mismatch.
error in the debug export template but not the The assembly 'GodotSharp' is out of sync.
fatal error.
The "out of sync" error happens when the C# API was generated with a different API hash than the C++ glue.
How are you building the Godot binary that will generate the glue? Is it the same version as the Godot editor you use to export?
About the linker errors on macOS. I think it's because of this: https://github.com/godotengine/godot/blob/e2b66cacf78ae39b94df748e9740b98a1f011e77/modules/mono/build_scripts/mono_configure.py#L243-L244
This variable: https://github.com/godotengine/godot/blob/e2b66cacf78ae39b94df748e9740b98a1f011e77/modules/mono/build_scripts/mono_configure.py#L166
Should be:
is_apple = env['platform'] in ['osx', 'iphone']
It is the same version. I do create branch from 3.2-stable tag.
And then in Ubuntu (without GUI), i do run the commands below: As platform it only supports Android and Server. And Android cannot be used for mono glue generation, only option is to use server for platform.
scons p=server tools=yes module_mono_enabled=yes mono_glue=no -j 6
./bin/godot_server.x11.tools.64.mono --generate-mono-glue modules/mono/glue
Can you run the following commands with both the editor and your server build?
godot --class-db-json
It should create the file user://class_db_api.json
(the command will print the real path at the end).
Then upload both files or the diff here to see what's changed.
@neikeq: shouldn't the server build used to generate the glue have the same disabled modules as the template? Many modules register public APIs.
Can you run the following commands with both the editor and your server build?
godot --class-db-json
It should create the file
user://class_db_api.json
(the command will print the real path at the end).Then upload both files or the diff here to see what's changed.
I ran the command "./bin/godot_server.x11.tools.64.mono --class-db-json" in ubuntu.
I got the error: ERROR: initialize_load_assemblies: Mono: This binary was built with 'mono_glue=no'; cannot load assemblies.
Then I ran the command below:
scons p=server tools=yes target=release_debug module_mono_enabled=yes mono_glue=yes -j 6
But i got another error:
Errors in packages.config projects Unable to find version '2.1.1' of package 'DotNet.Glob'. /root/.nuget/packages/: Package 'DotNet.Glob.2.1.1' is not found on source '/root/.nuget/packages/'.
About the linker errors on macOS. I think it's because of this: https://github.com/godotengine/godot/blob/e2b66cacf78ae39b94df748e9740b98a1f011e77/modules/mono/build_scripts/mono_configure.py#L243-L244
This variable: https://github.com/godotengine/godot/blob/e2b66cacf78ae39b94df748e9740b98a1f011e77/modules/mono/build_scripts/mono_configure.py#L166
Should be:
is_apple = env['platform'] in ['osx', 'iphone']
@neikeq I updated the code as you suggested in mono_configure.py file. I can create Android export templates without any problem on Mac now. I also used new custom templates on the editor which i complied. And I tested on mobile phone. Everything works perfectly now. Thanks a lot for your support.
I am not sure that this ticket is really needed anymore. Do you want me to close ticket?
Could anyone write down the steps what are needed to build Android export templates? I've built the Mono runtime for Android and now It is needed to generate the glue. There isn't an example in the documentation for the Mono version.
@ksvslk Everything is described in https://docs.godotengine.org/en/3.2/development/compiling/compiling_with_mono.html
Note that to generate the glue you need a tools=yes
build (i.e. a desktop build for your host platform).
Then you need to build the Mono runtime for Android using the linked build scripts in https://github.com/godotengine/godot-mono-builds See https://docs.godotengine.org/en/3.2/development/compiling/compiling_with_mono.html#building-the-mono-runtime And then https://docs.godotengine.org/en/3.2/development/compiling/compiling_with_mono.html#targeting-android
@ksvslk Everything is described in https://docs.godotengine.org/en/3.2/development/compiling/compiling_with_mono.html
Note that to generate the glue you need a
tools=yes
build (i.e. a desktop build for your host platform).Then you need to build the Mono runtime for Android using the linked build scripts in https://github.com/godotengine/godot-mono-builds See https://docs.godotengine.org/en/3.2/development/compiling/compiling_with_mono.html#building-the-mono-runtime And then https://docs.godotengine.org/en/3.2/development/compiling/compiling_with_mono.html#targeting-android
Okay. That was the thing - so I need to generate the glue for my host platform (not for Android in this case). But do I need to use the custom built editor then when exporting also?
But do I need to use the custom built editor then when exporting also?
Yes, when you do a custom build for templates, you most likely also need a custom build of the editor from the same commit. Otherwise the export might break if there are API changes between the version used in editor and in template.
But do I need to use the custom built editor then when exporting also?
Yes, when you do a custom build for templates, you most likely also need a custom build of the editor from the same commit. Otherwise the export might break if there are API changes between the version used in editor and in template.
Thanks for the help. To conclude:
scons p=windows tools=yes module_mono_enabled=yes mono_glue=no
bin\godot.windows.tools.64.mono --generate-mono-glue modules/mono/glue
scons p=windows target=release_debug tools=yes module_mono_enabled=yes
scons p=android target=release_debug tools=no module_mono_enabled=yes
scons p=android target=release tools=no module_mono_enabled=yes
One more question: Do I have to build the Mono runtime for Windows also (in the above case) using the same Mono version?
Godot version: Godot Mono 3.2 Stable
OS/device including version: macOS high sierra
Issue description: To reduce APK size of the game, I created android custom template on Ubuntu 18.04. I could not create it on Mac and I already raised bug for it: https://github.com/godotengine/godot/issues/36508
Steps to reproduce: 1 - Open Godot Mono 3.2 Stable on Mac 2 - Use Android export template which is created in Ubuntu 18.04 3 - Export the game for Android (Debug or Release) 4 - Use adb install to install game into the phone.
When i open the game, It crashes.
Logcat output with Debug apk:
Logcat output with Release apk: