-
报错说明:
由于使用了NDK编译的可执行文件在应用中调用,在4.4及之前的版本上一直没出问题。最近由于要测试在Android L上的运行情况发现,当运行该可执行文件时,报如下错误:
error: only position independent executables (PIE) are supported. -
报错原因:
PIE这个安全机制从4.1引入,但是Android L之前的系统版本并不会去检验可执行文件是否基于PIE编译出的。因此不会报错。但是Android L已经开启验证,如果调用的可执行文件不是基于PIE方式编译的,则无法运行 -
解决办法:
export CFLAGS="-pie -fPIE"
error: only position independent executables (PIE) are supported.
最新推荐文章于 2024-04-15 09:35:10 发布