Compiling Rust for Android


#1

Hello,

I’m trying to get Rust compiled so that it supports targeting Android, this approach is trying reproduce this: https://github.com/tomaka/android-rs-glue in nix.

The rust specific code Nix code can be found here: https://github.com/sjmackenzie/fractalide/blob/fractalide/build-support/rust-android.nix

How do I get Android support for Rust?

Can anybody can see something that’s glaringly obvious, please mention it!

/sjm

$ time nix-build --argstr debug true -A fvm-android
...
rustc: x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_llvm
rustc: x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_back
rustc: x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_data_structures
rustc: x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc
rustc: x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_borrowck
rustc: x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_platform_intrinsics
rustc: x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_typeck
rustc: x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_mir
rustc: x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_resolve
rustc: x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_trans
rustc: x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_privacy
rustc: x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_lint
rustc: x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_metadata
rustc: x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_plugin
rustc: x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libsyntax_ext
rustc: x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_driver
rustc: x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/bin/rustc
cp: x86_64-unknown-linux-gnu/stage1/lib/libstd
cp: x86_64-unknown-linux-gnu/stage1/lib/libarena
cp: x86_64-unknown-linux-gnu/stage1/lib/libflate
cp: x86_64-unknown-linux-gnu/stage1/lib/libgetopts
cp: x86_64-unknown-linux-gnu/stage1/lib/libgraphviz
cp: x86_64-unknown-linux-gnu/stage1/lib/liblog
cp: x86_64-unknown-linux-gnu/stage1/lib/libterm
cp: x86_64-unknown-linux-gnu/stage1/lib/libserialize
cp: x86_64-unknown-linux-gnu/stage1/lib/libsyntax
cp: x86_64-unknown-linux-gnu/stage1/lib/libfmt_macros
cp: x86_64-unknown-linux-gnu/stage1/lib/librbml
cp: x86_64-unknown-linux-gnu/stage1/lib/librustc_front
cp: x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm
cp: x86_64-unknown-linux-gnu/stage1/lib/librustc_back
cp: x86_64-unknown-linux-gnu/stage1/lib/librustc_data_structures
cp: x86_64-unknown-linux-gnu/stage1/lib/librustc
cp: x86_64-unknown-linux-gnu/stage1/lib/librustc_borrowck
cp: x86_64-unknown-linux-gnu/stage1/lib/librustc_platform_intrinsics
cp: x86_64-unknown-linux-gnu/stage1/lib/librustc_typeck
cp: x86_64-unknown-linux-gnu/stage1/lib/librustc_mir
cp: x86_64-unknown-linux-gnu/stage1/lib/librustc_resolve
cp: x86_64-unknown-linux-gnu/stage1/lib/librustc_trans
cp: x86_64-unknown-linux-gnu/stage1/lib/librustc_privacy
cp: x86_64-unknown-linux-gnu/stage1/lib/librustc_lint
cp: x86_64-unknown-linux-gnu/stage1/lib/librustc_metadata
cp: x86_64-unknown-linux-gnu/stage1/lib/librustc_plugin
cp: x86_64-unknown-linux-gnu/stage1/lib/libsyntax_ext
cp: x86_64-unknown-linux-gnu/stage1/lib/librustc_driver
cp: x86_64-unknown-linux-gnu/stage1/bin/rustc
cp: x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler-rt.a
rustc: x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore
: CommandLine Error: Option 'pass-remarks' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options
/tmp/nix-build-rustc-2016-01-10-gd70ab2b.drv-1/rust-d70ab2b/mk/target.mk:194: recipe for target 'x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/stamp.core' failed
make: *** [x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/stamp.core] Error 1
builder for ‘/nix/store/p0ya6ssiy6bxxf64y3vy5wpg1dj4rb9i-rustc-2016-01-10-gd70ab2b.drv’ failed with exit code 2
error: build of ‘/nix/store/p0ya6ssiy6bxxf64y3vy5wpg1dj4rb9i-rustc-2016-01-10-gd70ab2b.drv’ failed

real    64m53.404s
user    0m0.225s
sys     0m0.088s