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

root@hlte:/data/local # ./tcpdump -p -s 0                                       
error: only position independent executables (PIE) are supported.

has been used in the application since the NDK compiled executable file has been used in the 4.4 and previous versions. Recently, due to the test of running on Android L, we found that the above error was reported when running the executable file

The safety mechanism of pie is introduced from 4.1, but the system versions before Android l do not check whether the executable files are compiled based on pie. Therefore, no error will be reported. However, Android L has enabled verification. If the executable file is not compiled based on pie, it cannot run. The solution is to add the following flag to android.mk

LOCAL_CFLAGS += -pie -fPIE
LOCAL_LDFLAGS += -pie -fPIE

A complete solution for packet capture of Android intelligent mobile terminal based on tcpdump

Application implementation of Android tcpdump packet capture

Android grabs packets through tcpdump

This article shares CSDN – Donghai Chen Guangjian.

Similar Posts: