方式一,导出standalone
cd <ndk-home>
./build/tools/make-standalone-toolchain.sh --platform=android-8 --install-dir=<stand-alone-build>/android-8 --arch=arm --toolchain=arm-linux-androideabi-4.8 --system=linux-x86_64
export PATH=<stand-alone-build>/android-8/bin:$PATH
export PATH=<ndk-home>:$PATH


方式二,直接用ndk中的gcc编译
export PATH=<ndk-home>:$PATH


makefile中修改gcc

ARM-GCC-PATH=${NDK_HOME}/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin
CC=$(ARM-GCC-PATH)/arm-linux-androideabi-gcc --sysroot=${NDK_HOME}/platforms/android-8/arch-arm/
AR=$(ARM-GCC-PATH)/arm-linux-androideabi-ar
Logo

更多推荐