IPerf3 execution from Android 7

https://stackoverflow.com/questions/40975003/iperf3-execution-from-android-7-doesnt-work


I found your question and it helped me to build iperf3 for Android, but I reached on same problem.
Are you using build toolchains from Ubuntu repository? If yes, built binaries it will not work on Android 7.0, because they are using an old version of build toolchains. You will need to build the binaries with most recent NDK version. (now is r13b)

How I solved it:
-Putted all iperf3 sources from src folder on jni folder
-Created Android.mk and Application.mk, which I'll post below, on same folder, along with other files.
-Inside jni folder, I ran ndk-build and, voila, all binaries on /libs folder, working even on Android 7.0 (pick the binaries, put on assets folder and implement your strategy to load the correct binary for the right abi, or just get armeabi binary and load into your app)

Tip: iperf3 uses an folder to cache the results which is inaccessible for Android. You'll need to change this folder to work:
https://github.com/esnet/iperf/blob/670c18584bcf7a285f3561eb7ea38cc53600d0ab/src/iperf_api.c#L2621

Android.mk: (I think that is not necessary to put .h files on this script)
http://pastebin.com/fPsn0wsD

Application.mk:
http://pastebin.com/sgSsGNqB

I recommend to use ndk-build to build library to make more easier to build iperf3 for different architectures, like x86.

iperf3  -  Android.mk:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

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

LOCAL_MODULE := iperf3
LOCAL_SRC_FILES :=                         cjson.c \
                                           cjson.h \
                                           flowlabel.h \
                                           iperf.h \
                                           iperf_api.c \
                                           iperf_api.h \
                                           iperf_error.c \
                   			               iperf_client_api.c \
                                           iperf_locale.c \
                                           iperf_locale.h \
                                           iperf_server_api.c \
                                           iperf_tcp.c \
                                           iperf_tcp.h \
                                           iperf_udp.c \
                                           iperf_udp.h \
                   			               iperf_sctp.c \
                   	                       iperf_sctp.h \
                                           iperf_util.c \
                                           iperf_util.h \
                                           main.c \
                                           net.c \
                                           net.h \
                   			               portable_endian.h \
                                           queue.h \
                                           tcp_info.c \
                                           tcp_window_size.c \
                                           tcp_window_size.h \
                                           timer.c \
                                           timer.h \
                                           units.c \
                                           units.h \
                                           version.h

include $(BUILD_EXECUTABLE)


iperf3  -  Application.mk:

APP_ABI := all
APP_PLATAFORM := android-16


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值