error: only position independent executables (PIE) are supported

简介: 由于使用了NDK编译的可执行文件在应用中调用,在4.4及之前的版本上一直没出问题。在AndroidL上的运行情况发现,当运行该可执行文件时,报如下错误:error: only position independent executables (PIE) are supported.PIE这个安全机制从4.1引入,但是Android L之前的系统版本并不会去检验可执行文件是否基于PIE编译出的。

由于使用了NDK编译的可执行文件在应用中调用,在4.4及之前的版本上一直没出问题。在AndroidL上的运行情况发现,当运行该可执行文件时,报如下错误:

error: only position independent executables (PIE) are supported.

PIE这个安全机制从4.1引入,但是Android L之前的系统版本并不会去检验可执行文件是否基于PIE编译出的。因此不会报错。但是Android L已经开启验证,如果调用的可执行文件不是基于PIE方式编译的,则无法运行。解决办法非常简单,在Android.mk中加入如下flag就行。

LOCAL_CFLAGS += -pie -fPIE
LOCAL_LDFLAGS += -pie -fPIE
相关文章
|
8月前
GEE错误——Layer error: Image.connectedPixelCount: Segment size calculation on floating point bands is n
GEE错误——Layer error: Image.connectedPixelCount: Segment size calculation on floating point bands is n
88 0
HALCON error #1302: Wrong value of control parameter: 2 in operator affine_trans_region
HALCON error #1302: Wrong value of control parameter: 2 in operator affine_trans_region
|
6月前
|
Ubuntu Linux Python
UserWarning: Glyph 27668 (\N{CJK UNIFIED IDEOGRAPH-6C14}) missing from current font.
UserWarning: Glyph 27668 (\N{CJK UNIFIED IDEOGRAPH-6C14}) missing from current font.
276 2
|
计算机视觉
The specified pixels is not supported
The specified pixels is not supported
148 1
UserWarning: Glyph 28857 (\N{CJK UNIFIED IDEOGRAPH-70B9}) missing from current font. FigureCanvasA
UserWarning: Glyph 28857 (\N{CJK UNIFIED IDEOGRAPH-70B9}) missing from current font. FigureCanvasA
UserWarning: Glyph 28857 (\N{CJK UNIFIED IDEOGRAPH-70B9}) missing from current font. FigureCanvasA
成功解决KeyError: “Passing list-likes to .loc or [] with any missing labels is no longer supported. The
成功解决KeyError: “Passing list-likes to .loc or [] with any missing labels is no longer supported. The
ValueError: Error when checking : expected input_1 to have 4 dimensions, but got array with shape
ValueError: Error when checking : expected input_1 to have 4 dimensions, but got array with shape
416 0
|
人工智能
The left-hand side of an assignment must be a variable
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Helvetica Neue'; color: #454545} p.p2 {margin: 0.
1231 0
|
Android开发 安全
error: only position independent executables (PIE) are supported.
root@hlte:/data/local # ./tcpdump -p -s 0 error: only position independent executables (PIE) are supported. 由于使用了NDK编译的可执行文件在应用中调用,在4.4及之前的版本上一直没出问题。
1907 0