无法使用 Cygwin 编译 netperf 2.7.0

Failed to compile netperf 2.7.0 using Cygwin

不确定在这里问这个问题是否合适,但我在使用 Cygwin 获取 netperf 2.7.0 时遇到了问题。根据我读到的内容,很多人都成功地让 netperf 使用 Cygwin 进行编译,所以我希望我遗漏了一些我忘记安装的库,并希望有人能告诉我一些关于这个的信息。

这是我编译的步骤顺序。

wget https://github.com/HewlettPackard/netperf/archive/netperf-2.7.0.tar.gz
tar -zxvf netperf-2.7.0.tar.gz
cd netperf-netperf-2.7.0
./configure
./make all

以下是错误输出的片段

mv -f .deps/netcpu_none.Tpo .deps/netcpu_none.Po
gcc     -o netperf.exe netperf.o netlib.o netsh.o nettest_bsd.o nettest_dlpi.o nettest_unix.o nettest_xti.o nettest_sctp.o nettest_sdp.o nettest_omni.o net_uuid.o dscp.o netcpu_none.o  -lm
/usr/lib/gcc/x86_64-pc-cygwin/9.3.0/../../../../x86_64-pc-cygwin/bin/ld: netlib.o:netlib.c:(.text+0x1b46): undefined reference to `__CPU_ZERO'
netlib.o:netlib.c:(.text+0x1b46): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__CPU_ZERO'
/usr/lib/gcc/x86_64-pc-cygwin/9.3.0/../../../../x86_64-pc-cygwin/bin/ld: netlib.o:netlib.c:(.text+0x1b57): undefined reference to `__CPU_SET'
netlib.o:netlib.c:(.text+0x1b57): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__CPU_SET'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:305: netperf.exe] Error 1
make[3]: Leaving directory '/home/David Chu/workspace/netperf-netperf-2.7.0/src'
make[2]: *** [Makefile:352: all-recursive] Error 1
make[2]: Leaving directory '/home/David Chu/workspace/netperf-netperf-2.7.0/src'
make[1]: *** [Makefile:277: all-recursive] Error 1
make[1]: Leaving directory '/home/David Chu/workspace/netperf-netperf-2.7.0'
make: *** [Makefile:215: all] Error 2

附件是完整的编译日志

compilation.log

提前致谢!

注意:同样的问题也在 netperf github 的项目上 posted 但是 activity 在那个项目上几乎没有所以我决定 post这里也是。 https://github.com/HewlettPackard/netperf/issues/41

您可以尝试使用 #if 1 //__GNU_VISIBLE,

对 /usr/include/sys/cpuset.h 进行更改

并在 src/netlib.c

中从 __CPU_ZERO 中删除 __