error: only position independent executables (PIE) are supported.
1
error: only position independent executables (PIE) are supported.
       这是由于PIE安全机制所引起的,从Android4.1开始引入该机制,但是Android L之前的系统版本并不会去检验可执行文件是否基于PIE编译出的。因此不会报错。但是Android L已经开启验证,如果调用的可执行文件不是基于PIE方式编译的,则无法运行。解决办法非常简单,编译的时候加上如下的flag就行。


LOCAL_CFLAGS += -pie -fPIE
LOCAL_LDFLAGS += -pie -fPIE
1
2
LOCAL_CFLAGS += -pie -fPIE
LOCAL_LDFLAGS += -pie -fPIE

 

相关文章:

  • 2021-07-16
  • 2022-01-01
  • 2022-02-08
  • 2022-12-23
  • 2022-12-23
  • 2021-12-28
  • 2021-06-08
  • 2022-12-23
猜你喜欢
  • 2021-12-02
  • 2021-05-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案