my busybox +android bionic + ndk tips, etc

Dan Fandrich dan at coneharvesters.com
Mon Aug 29 19:45:25 UTC 2011


On Mon, Aug 29, 2011 at 08:21:12PM +0100, Hin-Tak Leung wrote:
> 1. Firstly, there is a useful but obscure tips: One can make a standalone toolchain from the ndk with:
> 
> <ndk_directory>/build/tools/make-standalone-toolchain.sh \
> --platform=android-8

I wasn't aware of that script. That certainly looks like it would simplify
the building process for Android.

> 3. After looking at and applying some of the patches,
> I found that I needed to remove a few more things in "configs/android_defconfig" (some of that are due to missing headers, some due to missing libc routines, see also 4.):
> 
> < # CONFIG_HOSTID is not set
> < # CONFIG_WHO is not set
> < # CONFIG_USERS is not set
> < # CONFIG_LESS is not set
> < # CONFIG_ARP is not set
> < # CONFIG_IFCONFIG is not set
> < # CONFIG_UPTIME is not set
> 
> 4. At the final linker stage, here are a list of missing symbols:
> 
> ar.c: undefined reference to `dprintf'
> bb_askpass.c: undefined reference to `fputs_unlocked'
> cut.c: undefined reference to `fputs_unlocked'
> dc.c: undefined reference to `pow'
[etc.]
> 
> Some of these are relatively easy to fix e.g. strchrnul can be replaced with a simply strchr-based macro.

These are already worked around in platform.h, and I see why they're not
working for you:

> 5. The android ndk compiler preprocessor defines 
> #define __ANDROID__ 1
> this is probably useful to distinguish it from other ARM-targeted cross-gcc's.

Android builds themselves use #define ANDROID 1 instead, and that's what the
android_defconfig defines to enable an Android build configuration. If the 
NDK standalone toolchain enables __ANDROID__ instead, then Busybox should
probably switch to that instead.

> I hope this info is useful to somebody... and hope that busybox can be built cleanly with the android ndk soon... :-).

Can you try setting -DANDROID in your .config file and see if that makes it
work for you?

>>> Dan


More information about the busybox mailing list