Build your own NDK from the Android source tree

Let’s say you want to port a Linux tool to Android. You got the latest NDK and you tried building the Linux tool you want to port. You tool does not build because it depends on the latest bionic changes that did not make it into the latest NDK release. What can you do? Build your own NDK from Google’s source tree that will contain the latest bionic changes.

Prerequisites

If you haven’t done this already, you need to download the latest Google tree and compile it.

Build the NDK

You need to run the NDK script that builds sysroot. sysroot is the directory that will contain the libraries and header files for your target. You need to specify the ABI you want for the target.
For x86 you need to run:
$ ./ndk/build/tools/build-ndk-sysroot.sh --abi=x86
and for arm:
$ ./ndk/build/tools/build-ndk-sysroot.sh --abi=arm

Use the new NDK sysroot

If you want to cross compile any C application, you’ll need to use the new sysroot for NDK.
For x86:
$ export NDK_SYSROOT=${ANDROID_BUILD_TOP}/ndk/build/platforms/android-3/arch-x86
For arm:
$ export NDK_SYSROOT=${ANDROID_BUILD_TOP}/ndk/build/platforms/android-3/arch-arm

For details on how to cross compile a C application see Cross-compiling a C application using the Android NDK.


https://yaapb.wordpress.com/2012/09/27/build-your-own-ndk-from-the-google-source-tree/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值