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-x86For 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/

本文介绍如何从Google源代码树构建适用于Android的自定义NDK,以包含最新的bionic更改。文章提供了步骤指导,包括下载最新源代码、构建NDK及设置目标ABI等关键操作。
1238

被折叠的 条评论
为什么被折叠?



