mun
mun copied to clipboard
Android support
Mobile developers being one of our target audiences, we set the goal:
Leverage Mun's cross compilation to unlock hot reloading for console and mobile development.
Currently, Android is not one of Mun's supported target platforms.
The first steps towards achieving this goal, would be:
- [ ] Investigate compilation of and linking to
mun_runtimefor Android-supported targets - [ ] Investigate opening of shared libraries (needed for
*.munlibs) with the Android SDK
Investigate compilation of and linking to mun_runtime for Android-supported targets
mun_runtime 0.3.0 and 0.2.0 compiles without a problem to armv7-linux-androideabi platform using cargo-apk.
Investigate opening of shared libraries (needed for *.munlibs) with the Android SDK
In case when one wants to release game that use mun as embedded language, he needs to inject all .munlib files into apk, for distribution purpose. So i tried that: saved .munlib in assets and then load it from AssetManager, problem is that asset manager open assets in the streaming mode(and that's the only way asset manager can), while mun_runtime uses libloading lib which accept only string path to file. So there need to be some specific code for android platform in that case.
~~I did not tried cases where .munlib loads from internal/external android storages.~~
I tried case where mun_runtime read .munlib from external storage:
Seems like it's reading .munlib without problems, but after that mun_runtime try to create temp file in "/data/local/tmp/.*", problem is that "/data/local/" path is protected on android system and it can't be used in android apps (maybe it can be on rooted devices).
Here example error output:
08-25 10:32:09.831 19215 19276 I RustStdoutStderr: thread '<unnamed>' panicked at 'Failed to spawn Runtime: Permission denied (os error 13) at path "/data/local/tmp/.tmpqOPqYS"', src\lib.rs:9:87
And so path for temp files should be changed in order to support android (tempfile crate is responsible for temp files and, i guess, also for "/data/local/" path).
@legendiguess thanks for figuring all this out!
Could you raise an issue with tempfile regarding the incorrect location?
The compiler also has to get a new target so we can compile mun to arm.
The compiler also has to get a new target so we can compile mun to arm.
Can you please explain? Doesn't rustc compiler already have all needed targets for android? (armv7-linux-androideabi, aarch64-linux-android, i686-linux-android, x86_64-linux-android)
The rust compiler does, but the mun compiler also needs to be able to generate arm code. It doesnt yet.