移植Iperf到android 用来学习linux移植到安卓的例子
Iperf移植记录
1.生成arm编译需要的头文件config.h
./configure --host=arm
如果需要make clean
make distclean
2.增加Android.mk文件
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
compat/delay.cpp \
compat/error.c \
compat/gettimeofday.c \
compat/inet_ntop.c \
compat/inet_pton.c \
compat/signal.c \
compat/snprintf.c \
compat/string.c \
compat/Thread.c
LOCAL_SRC_FILES += \
src/Client.cpp \
src/Extractor.c \
src/gnu_getopt.c \
src/gnu_getopt_long.c \
src/Launch.cpp \
src/List.cpp \
src/Listener.cpp \
src/Locale.c \
src/main.cpp \
src/PerfSocket.cpp \
src/ReportCSV.c \
src/ReportDefault.c \
src/Reporter.c \
src/Server.cpp \
src/service.c \
src/Settings.cpp \
src/SocketAddr.c \
src/sockets.c \
src/stdio.c \
src/tcp_window_size.c
LOCAL_C_INCLUDES += \
$(LOCAL_PATH) \
$(LOCAL_PATH)/include
LOCAL_CFLAGS += -Wno-format-security
LOCAL_CFLAGS += -DHAVE_CONFIG_H
LOCAL_LDLIBS += -lpthread
LOCAL_SHARED_LIBRARIES := libc libm libcutils libnetutils
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := iperf
include $(BUILD_EXECUTABLE)
如果不加LOCAL_CFLAGS += -Wno-format-security
编译提示出错:
format not a string literal and no format arguments [-Werror=format-security]
cc1: some warnings being treated as errors
修改Android.mk
LOCAL_CFLAGS += -Wno-format-security
3.在源码目录下执行mm -B
生成iperf可执行文件,push iperf到system/bin就可以使用
整个移植过程还是比较顺利的,在[-Werror=format-security]问题上卡了比较久,对linux c编译还不够熟悉。
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。