编译iperf3.1.3 出错 ld: cannot find gcrt1.o

在网站 https://iperf.fr/iperf-download.php 上能下载到iperf3.1.3的各种版本,但是没有mips、mipsel、arm平台的二进制文件,看来只有自己编译了。

我自己有arm mips mipsel 的交叉工具,编译arm平台的很顺利,在编译mips及mipsel的时候报错。

ld: cannot find gcrt1.o:

看见网文 iperf3.0 hisi uclib 交叉编译 也提到了这个错误,才知道用uclibc 库编译会出现这样的错误,我的mips 及mipsel 用的就是uclibc库,看来uclibc 的库中没有gcrt1.o这个文件。

没有按照上述网文修改src目录下Makefile.in 而是按照iperf 3.10.1的src/Makefile.in修改。

修改后,解决了iperf3.1.3 编译的问题,经测试在arm、mips、mipsel、x86_64平台上都正常。

diff.patch

diff -ruNp org/iperf-3.1.3/src/Makefile.in iperf-3.1.3/src/Makefile.in
--- org/iperf-3.1.3/src/Makefile.in	2016-06-07 02:18:49.000000000 +0800
+++ iperf-3.1.3/src/Makefile.in	2021-07-30 22:33:04.696243888 +0800
@@ -607,12 +607,21 @@ iperf3_LDFLAGS = -g
 
 # Specify the sources and various flags for the profiled iperf binary. This
 # binary recompiles all the source files to make sure they are all profiled.
-iperf3_profile_SOURCES = main.c \
-						  $(libiperf_la_SOURCES)
+#iperf3_profile_SOURCES = main.c \
+#						  $(libiperf_la_SOURCES)
 
-iperf3_profile_CFLAGS = -pg -g
-iperf3_profile_LDADD = libiperf.la
-iperf3_profile_LDFLAGS = -pg -g
+##mod iperf3_profile_CFLAGS = -pg -g
+#iperf3_profile_CFLAGS = -g
+#iperf3_profile_LDADD = libiperf.la
+##mod iperf3_profile_LDFLAGS = -pg -g
+#iperf3_profile_LDFLAGS = -g
+
+@ENABLE_PROFILING_TRUE@iperf3_profile_SOURCES = main.c \
+@ENABLE_PROFILING_TRUE@                          $(libiperf_la_SOURCES)
+
+@ENABLE_PROFILING_TRUE@iperf3_profile_CFLAGS = -pg -g
+@ENABLE_PROFILING_TRUE@iperf3_profile_LDADD = libiperf.la
+@ENABLE_PROFILING_TRUE@iperf3_profile_LDFLAGS = -pg -g
 
 # Specify the sources and various flags for the test cases
 t_timer_SOURCES = t_timer.c

我对编译中加 -pg -g参数有疑问,就继续找文章。找到了网文 gcc编译选项的-g -pg和-l

才知道加 -pg -g 是调试用的,简单测试下uclibc库不支持-pg 选项。

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值