9. README.android
How to cross-compile for Android.
These notes were last updated on
17 Feb 2012, for Valgrind SVN revision 12390/2257.
This is known to work at least for :
ARM:
Android 4.0.3 running on a (rooted, AOSP build) Nexus S.
Android 4.0.3 running on Motorola Xoom.
Android 4.0.3 running on android arm emulator.
Android 4.1
running on android emulator.
Android 2.3.4 on Nexus S worked at some time in the past.
x86:
Android 4.0.3 running on android x86 emulator.
On android-arm, GDBserver might insert breaks at wrong addresses.
Feedback on this welcome.
Other configurations and toolchains might work, but haven’t been tested.
Feedback is welcome.
You need the android-ndk-r6 native development kit.
r6b and r7
give a non-completely-working build; see
http://code.google.com/p/android/issues/detail?id=23203
For the android emulator, the versions needed and how to
install them are described in README.android_emulator.
Install it somewhere.
Doesn’t matter where.
Then do this:
# Modify this (obviously).
Note, this "export" command is only done
# so as to reduce the amount of typing required.
None of the commands
# below read it as part of their operation.
#
export NDKROOT=/path/to/android-ndk-r6
# Modify this too.
Tell the build system which Android hardware you
# are building for.
It needs to know this so it can compile in
# support for the right Android-hw-specific ioctls.
(sigh.)
As with
# NDKROOT above, this is merely to avoid repeated typing; none of the
# commands read it.
#
# Currently the supported values are:
nexus_s pandaboard
# So choose one of the below:
#
export HWKIND=nexus_s
# Samsung Nexus S; also Xoom (for now)
export HWKIND=generic
# A generic Android device. eg, Pandaboard
export HWKIND=emulator
# Android emulator
89