Build Android Toolchains for Android (host=arm-linux-androideabi and target=arm-linux-androideabi)

79 views
Skip to first unread message

Bob

unread,
Jun 13, 2015, 1:04:04 PM6/13/15
to andro...@googlegroups.com
Hi, 

I want to build a set of toolchains (e.g., objdump) hosting/targeting Android. I just downloaded toolchains repository from aosp. I can build on my Ubuntu 14.04 machine. I can't find any documentation about building toolchains for arm-linux-androideabi. Are there any related materials online? Thank you so much.

Best,
Bob

Surge Raval

unread,
Feb 10, 2017, 9:05:09 PM2/10/17
to android-ndk
just do as you would for any toolchain build, but use ndk sysroot as sysroot for headers, define dynamic-linker=/system/bin/linker. I'd suggest to do a bootstrap build and set stage1 LDFLAGS to static. This will require making a few static libraries not found in ndk sysroot. Don't use glibc, build with newlib and add the path to ndk sysroot to LDFLAGS so it uses bionic headers.

probabaly a minimum of these:

LIBS='-lc -ldl -lgcc -lm -lz -lsupc++ -lstdc++ -lgnustl_static'

If you use shared libraries, you'll get a linker error when trying to execute any toolchain binaries since android will look for the libs in the default library path (most likely /system/lib /system/lib64)

And must configure with the -fPIC flag for android.

For just objdump, cross compiling binutils with target and host set to android arch triplet should be OK.

Takes a bit of work, but certainly is possible.


angler:/data/toolchain/bin # file objdump
objdump: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, stripped

angler:/data/toolchain/bin # file gcc
gcc: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, stripped


Reply all
Reply to author
Forward
0 new messages