0

I am working on a Android NDK Project using Iperf library for measuring network performance. App is working perfect up to Android version 4.x.But not working in Android latest versions from 5.x(Lollipop), getting an error "error: only position independent executables (PIE) are supported.".I am using Eclipse Luna, NDK12. Please reply if anybody has the solution to this . Thanks in Advance.

`LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

# Enable PIE manually. Will get reset on $(CLEAR_VARS). This
# is what enabling PIE translates to behind the scenes.
LOCAL_CFLAGS += -fPIE
LOCAL_LDFLAGS += -fPIE -pie

L_DEFS := -DHAVE_CONFIG_H -UAF_INET6
L_CFLAGS := $(L_DEFS)



L_COMMON_HDR := Condition.h gnu_getopt.h Locale.h Reporter.h Thread.h config.win32.h headers.h Mutex.h service.h util.h Extractor.h inet_aton.h report_CSV.h snprintf.h version.h gettimeofday.h List.h report_default.h SocketAddr.h \
Client.hpp Listener.hpp Server.hpp Timestamp.hpp delay.hpp PerfSocket.hpp Settings.hpp

L_COMMON_SRC := Extractor.c Locale.c Reporter.c sockets.c gnu_getopt.c ReportCSV.c service.c stdio.c gnu_getopt_long.c ReportDefault.c SocketAddr.c tcp_window_size.c \
Client.cpp List.cpp main.cpp Server.cpp Launch.cpp Listener.cpp PerfSocket.cpp Settings.cpp

L_COMMON_COMPAT := headers_slim.h error.c inet_ntop.c signal.c string.c gettimeofday.c inet_pton.c snprintf.c Thread.c delay.cpp

iperf_SOURCES := $(L_COMMON_HDR) $(L_COMMON_SRC) $(L_COMMON_COMPAT)

include $(CLEAR_VARS)

LOCAL_MODULE := iperf
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := tests eng
LOCAL_CFLAGS := $(L_CFLAGS)
LOCAL_SRC_FILES := $(iperf_SOURCES)
LOCAL_DISABLE_FORMAT_STRING_CHECKS := true
include $(BUILD_EXECUTABLE)`
kishore
  • 27
  • 7
  • 1
    Possible duplicate of [Running a native library on Android L. error: only position independent executables (PIE) are supported](http://stackoverflow.com/questions/24818902/running-a-native-library-on-android-l-error-only-position-independent-executab) – mstorsjo Apr 18 '16 at 10:14
  • I have added these two line in Android.mk file `LOCAL_CFLAGS += -fPIE LOCAL_LDFLAGS += -fPIE -pie` but no change – kishore Apr 18 '16 at 11:29
  • did you solve the problem ?if you did , how? – Mehrdad May 13 '17 at 20:00

0 Answers0