我想从x86_64 ubuntu linux机器交叉编译iperf-2.0.5,以实现ARM64目标。因此,我安装了交叉编译器:
sudo apt install gcc make gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu g++-aarch64-linux-gnu
然后我尝试配置:
./configure --build=aarch64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --enable-static --disable-shared
这给了我这个警告:configure: WARNING: unrecognized options: --enable-static, --disable-shared
除了这个警告之外,我没有收到任何错误,但我不知道如何验证构建和主机参数是否正确选择。当我运行make时,我会得到以下错误。
make all-recursive
make[1]: Entering directory '/home/recherma/Documents/iperf-2.0.5'
Making all in compat
make[2]: Entering directory '/home/recherma/Documents/iperf-2.0.5/compat'
if g++ -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I../include -Wall -O2 -MT delay.o -MD -MP -MF ".deps/delay.Tpo" -c -o delay.o delay.cpp;
then mv -f ".deps/delay.Tpo" ".deps/delay.Po"; else rm -f ".deps/delay.Tpo"; exit 1; fi
In file included from /usr/include/c++/9/stdlib.h:36,
from ../include/headers.h:78,
from ../include/Timestamp.hpp:63,
from delay.cpp:53:
/usr/include/c++/9/cstdlib:151:11: error: ‘::malloc’ has not been declared
151 | using ::malloc;
| ^~~~~~
In file included from ../include/headers.h:78,
from ../include/Timestamp.hpp:63,
from delay.cpp:53:
/usr/include/c++/9/stdlib.h:65:12: error: ‘std::malloc’ has not been declared
65 | using std::malloc;
| ^~~~~~
In file included from /usr/include/c++/9/cmath:42,
from /usr/include/c++/9/math.h:36,
from ../include/headers.h:85,
from ../include/Timestamp.hpp:63,
from delay.cpp:53:
/usr/include/c++/9/bits/cpp_type_traits.h:214:12: error: redefinition of ‘struct std::__is_integer<int>’
214 | struct __is_integer<int>
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/9/bits/cpp_type_traits.h:138:12: note: previous definition of ‘struct std::__is_integer<int>’
138 | struct __is_integer<bool>
| ^~~~~~~~~~~~~~~~~~
make[2]: *** [Makefile:273: delay.o] Error 1
make[2]: Leaving directory '/home/recherma/Documents/iperf-2.0.5/compat'
make[1]: *** [Makefile:252: all-recursive] Error 1
make[1]: Leaving directory '/home/recherma/Documents/iperf-2.0.5'
make: *** [Makefile:190: all] Error 2
所以我想配置失败了。现在有人知道如何正确配置它吗?
编辑:我认为--主机应该改为aarch64未知的linux gnu。但这并没有改变什么,我得到了完全相同的错误。
尝试从configure.ac中删除DAST_CHECK_BOOL,然后再次尝试重新配置。
如果没有帮助,请在配置之后,在config.h中注释#define bool int
,然后尝试重新生成。