下载NDK
从NDK官网下载NDK,并上传到服务器任意目录,本文上传到/home/syq目录中。
当前最新稳定版为r21b。
从NDK导出工具链
cd /home/syq/android-ndk-r21b #NDK的安装目录
./make-standalone-toolchain.sh --platform=android-24 --install-dir=/home/syq/android-toolchain --force #生成工具链
编译脚本
注意:要仔细研究“configure --help”的输出
#!/bin/bash
export NDK_TOOLCHAIN_DIR=/home/syq/android-toolchain/
export INSTALL_DIR=/home/syq/install/fdk-aac-arm
export CONFIGURE_FLAGS="--prefix=$INSTALL_DIR --enable-example --with-aix-soname=-arm"
export PATH=$PATH:$NDK_TOOLCHAIN_DIR/bin/
./autogen.sh
./configure $CONFIGURE_FLAGS --host=arm-linux-androideabi CC=arm-linux-androideabi-gcc
make -j8
make install
编译过程中的错误:
CXX libSBRdec/src/psbitdec.lo
libSBRdec/src/lpp_tran.cpp:342:5: error: use of undeclared identifier 'android_errorWriteLog'
android_errorWriteLog(0x534e4554, "112160868");
^
libSBRdec/src/lpp_tran.cpp:940:5: error: use of undeclared identifier 'android_errorWriteLog'
android_errorWriteLog(0x534e4554, "112160868");
^
2 errors generated.
Makefile:1575: recipe for target 'libSBRdec/src/lpp_tran.lo' failed
make: *** [libSBRdec/src/lpp_tran.lo] Error 1
make: *** Waiting for unfinished jobs....
把错误行的代码注释掉,即可。