源码下载地址:
iPerf - Download iPerf3 and original iPerf pre-compiled binaries
编译配置:
./configure --host=aarch64-v8aqcom-linux CC=aarch64-v8aqcom-linux-gcc CFLAGS=-static CXX=aarch64-v8aqcom-linux-g++ CXXFLAGS=-static
–host: 指定交叉编译工具,一般为arm-none-linux-gnueabi、arm-linux-gnueabihf、arm-linux等,具体要和目标板用的交叉编译工具对应。
编译:
然后 make 编译即可,编译完成,可在 src 目录下找到编译好的 iperf 应用,因其为静态编译,故直接将其放到开发板里就可以了
编译配置可能出现的bug:
1、需要更新config文件
报错:host system type... Invalid configuration `aarch64-v8aqcom-linux': machine `aarch64-v8aqcom' not recognized
解决措施:
下载这两个配置文件(config.guess和config.sub)
wget -O config.guess 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD'
wget -O config.sub 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD'
然后替换到源码的路径下
2、中间文件格式错误
报错:
gnu_getopt.o: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
Makefile:414: recipe for target 'iperf' failed
make[2]: *** [iperf] Error 1
make[2]: Leaving directory '/home/xuzj/iperf-2.0.9/src'
Makefile:377: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/xuzj/iperf-2.0.9'
Makefile:317: recipe for target 'all' failed
make: *** [all] Error 2
根因:
错在.o文件格式错误,其实是之前不同编译链下编译的中间文件复用到此次编译导致的格式错误。
解决:
make clean清除一下之前编译的中间文件,再make