Closed vmx closed 6 years ago
Seems that we're not linking the ndk on android. I'm not sure whether that should be done on this crate or on the executable. Perhaps explicitly linking it fixes the problem for you?
Explicit linking on the executable sounds good to me. Do you have any pointers on how to do that?
https://github.com/servo/servo/blob/master/ports/servo/build.rs looks like it might be relevant to that.
I played around with @tomaka's android-rs-glue
and tried to understand what it does differently (it use its own linker script). Sadly (after a few hours) I sadly still can't build my code for Android. Further help is appreciated (else I'll keep digging some other time).
The linking is successful when I add --sysroot /home/vmx/src/rust/android/android-ndk-r12b/platforms/android-18/arch-arm -shared
at the end of the linker command. Though that means that a shared library is created, which isn't really what I want, is it?
If someone wants to try it on a stand-alone minimal example repository, I've created one: https://github.com/vmx/rust-mozjs-issue-346
Seems to be fixed. I haven't tried if it actually runs on Android, but at least I don't get an error message when I compile it. Thanks a lot for fixing it.
The linker fails when running the tests via
cargo test --target=arm-linux-androideabi
. See the error and full command line below:In case you want to have a simple file to compile, an almost minimal example that shows the same issue is: