使用ndk中提供的工具安装指定版本的ndk链
(1)安装完整工具链
安装指定版本的工具到指定目录(如安装到/home/ndk-tools目录)
./build/tools/make-standalone-toolchain.sh --platform=android-23 --install-dir=/home/ndk-tools
(2) 添加环境变量
export PATH=$PATH:/home/ndk-tools/bin
添加后 arm-linux-androideabi-gcc -v检测版本号
(3)编译测试
arm-linux-androideabi-gcc hello.c -o hello
(4)PIE安全机制
Android 5 以上版本强制验证可执行程序是否基于PIE编译出。
make file增加-fPIE相关选项
ndk编译本地Linux程序
最新推荐文章于 2024-05-16 12:30:17 发布