[Nix-dev] Compiling Rust for Android
stewart mackenzie
setori88 at gmail.com
Sun Jan 31 17:58:53 CET 2016
Hello,
I'm trying to get rust compiled so that it supports targeting Android,
not entirely using svanderburg's method, this approach is trying
reproduce this: https://github.com/tomaka/android-rs-glue in nix.
A compilation takes between 64mins to 86mins, so advice from an
intersection of people with experience in nix + rust + llvm on android
would be super helpful.
The code can be found here:
https://github.com/sjmackenzie/fractalide/tree/fractalide (fractalide
branch rev 04a14140284ca9d7148b66f58e7a6801d25484de to be specific)
If one comments out this line:
https://github.com/sjmackenzie/fractalide/blob/fractalide/fvm/fvm-android/default.nix#L14
, rust successfully compiles but without the obviously needed android
support. If I uncomment the line, the below error prints.
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/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_privacy
rustc: x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_lint
rustc: x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_driver
rustc: x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustdoc
make: compiler-rt
make[1]: Entering directory
'/tmp/nix-build-rustc-2015-11-01-g1a2eaff.drv-14/rust-1a2eaff/src/compiler-rt'
/nix/store/r9nm6h97qywmsqnzsr95zs6xa2vxnwdg-ndk-standalone-toolchain/bin/arm-linux-androideabi-gcc:
relocation error:
/nix/store/r9nm6h97qywmsqnzsr95zs6xa2vxnwdg-ndk-standalone-toolchain/bin/arm-linux-androideabi-gcc:
symbol , version GLIBC_2.2.5 not defined in file libc.so.6 with link
time reference
warning: clang_darwin.mk: dropping arch 'i386' from lib 'eprintf'
(clang does not support it)
warning: clang_darwin.mk: dropping arch 'i386' from lib '10.4' (clang
does not support it)
warning: clang_darwin.mk: dropping arch 'x86_64' from lib '10.4'
(clang does not support it)
warning: clang_darwin.mk: dropping arch 'i386' from lib 'ios' (clang
does not support it)
warning: clang_darwin.mk: dropping arch 'x86_64' from lib 'ios' (clang
does not support it)
warning: clang_darwin.mk: dropping arch 'x86_64h' from lib 'ios'
(clang does not support it)
warning: clang_darwin.mk: dropping arch 'armv7' from lib 'ios' (clang
does not support it)
warning: clang_darwin.mk: dropping arch 'i386' from lib 'osx' (clang
does not support it)
warning: clang_darwin.mk: dropping arch 'x86_64' from lib 'osx' (clang
does not support it)
warning: clang_darwin.mk: dropping arch 'x86_64h' from lib 'osx'
(clang does not support it)
warning: clang_darwin.mk: dropping arch 'armv7' from lib 'cc_kext'
(clang does not support it)
warning: clang_darwin.mk: dropping arch 'i386' from lib 'cc_kext'
(clang does not support it)
warning: clang_darwin.mk: dropping arch 'x86_64' from lib 'cc_kext'
(clang does not support it)
warning: clang_darwin.mk: dropping arch 'x86_64h' from lib 'cc_kext'
(clang does not support it)
warning: clang_darwin.mk: dropping arch 'x86_64' from lib
'cc_kext_ios5' (clang does not support it)
warning: clang_darwin.mk: dropping arch 'x86_64h' from lib
'cc_kext_ios5' (clang does not support it)
warning: clang_darwin.mk: dropping arch 'armv7' from lib
'cc_kext_ios5' (clang does not support it)
warning: clang_darwin.mk: dropping arch 'i386' from lib 'profile_osx'
(clang does not support it)
warning: clang_darwin.mk: dropping arch 'x86_64' from lib
'profile_osx' (clang does not support it)
warning: clang_darwin.mk: dropping arch 'x86_64h' from lib
'profile_osx' (clang does not support it)
warning: clang_darwin.mk: dropping arch 'i386' from lib 'profile_ios'
(clang does not support it)
warning: clang_darwin.mk: dropping arch 'x86_64' from lib
'profile_ios' (clang does not support it)
warning: clang_darwin.mk: dropping arch 'x86_64h' from lib
'profile_ios' (clang does not support it)
warning: clang_darwin.mk: dropping arch 'armv7' from lib 'profile_ios'
(clang does not support it)
warning: clang_darwin.mk: dropping arch 'i386' from lib
'asan_osx_dynamic' (clang does not support it)
warning: clang_darwin.mk: dropping arch 'x86_64' from lib
'asan_osx_dynamic' (clang does not support it)
warning: clang_darwin.mk: dropping arch 'x86_64h' from lib
'asan_osx_dynamic' (clang does not support it)
warning: clang_darwin.mk: dropping arch 'i386' from lib 'ubsan_osx'
(clang does not support it)
warning: clang_darwin.mk: dropping arch 'x86_64' from lib 'ubsan_osx'
(clang does not support it)
warning: clang_darwin.mk: dropping arch 'x86_64h' from lib 'ubsan_osx'
(clang does not support it)
warning: clang_macho_embedded.mk: dropping arch 'armv6m' from lib 'soft_static'
warning: clang_macho_embedded.mk: dropping arch 'armv7m' from lib 'soft_static'
warning: clang_macho_embedded.mk: dropping arch 'armv7em' from lib 'soft_static'
warning: clang_macho_embedded.mk: dropping arch 'armv7' from lib 'soft_static'
warning: clang_macho_embedded.mk: dropping arch 'armv7em' from lib 'hard_static'
warning: clang_macho_embedded.mk: dropping arch 'armv7' from lib 'hard_static'
warning: clang_macho_embedded.mk: dropping arch 'i386' from lib 'hard_static'
warning: clang_macho_embedded.mk: dropping arch 'x86_64' from lib 'hard_static'
warning: clang_macho_embedded.mk: dropping arch 'armv6m' from lib 'soft_pic'
warning: clang_macho_embedded.mk: dropping arch 'armv7m' from lib 'soft_pic'
warning: clang_macho_embedded.mk: dropping arch 'armv7em' from lib 'soft_pic'
warning: clang_macho_embedded.mk: dropping arch 'armv7' from lib 'soft_pic'
warning: clang_macho_embedded.mk: dropping arch 'armv7em' from lib 'hard_pic'
warning: clang_macho_embedded.mk: dropping arch 'armv7' from lib 'hard_pic'
warning: clang_macho_embedded.mk: dropping arch 'i386' from lib 'hard_pic'
warning: clang_macho_embedded.mk: dropping arch 'x86_64' from lib 'hard_pic'
make/platform/clang_linux.mk:16: *** "unable to infer compiler target
triple for /nix/store/r9nm6h97qywmsqnzsr95zs6xa2vxnwdg-ndk-standalone-toolchain/bin/arm-linux-androideabi-gcc".
Stop.
make[1]: Leaving directory
'/tmp/nix-build-rustc-2015-11-01-g1a2eaff.drv-14/rust-1a2eaff/src/compiler-rt'
/tmp/nix-build-rustc-2015-11-01-g1a2eaff.drv-14/rust-1a2eaff/mk/rt.mk:351:
recipe for target 'arm-linux-androideabi/rt/libcompiler-rt.a' failed
make: *** [arm-linux-androideabi/rt/libcompiler-rt.a] Error 2
builder for ‘/nix/store/dsp34kaijggkwhp604c1wgbwmk89kq40-rustc-2015-11-01-g1a2eaff.drv’
failed with exit code 2
error: build of
‘/nix/store/dsp34kaijggkwhp604c1wgbwmk89kq40-rustc-2015-11-01-g1a2eaff.drv’
failed
real 64m53.404s
user 0m0.225s
sys 0m0.088s
```
More information about the nix-dev
mailing list