HewlettPackard / netperf

Netperf is a benchmark that can be used to measure the performance of many different types of networking. It provides tests for both unidirectional throughput, and end-to-end latency.
MIT License
859 stars 187 forks source link

Compilation error due to inline in netlib.c? #35

Open richardimaoka opened 5 years ago

richardimaoka commented 5 years ago

Description

Hi, I'm new to netperf, and encountered an error upon compiling it. I added more detail about how to reproduce this but basically:

wget https://github.com/HewlettPackard/netperf/archive/netperf-2.7.0.tar.gz
tar xvf netperf-2.7.0.tar.gz
cd netperf-netperf-2.7.0
./configure --enable-demo

# Here I encountered the error
make

The error was undefined reference to demo_interval_xxx as follows:

...
...
gcc     -o netperf 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_procstat.o  -lm
netlib.o: In function `demo_interval_final':
netlib.c:(.text+0x3de3): undefined reference to `demo_interval_display'
netlib.o: In function `demo_stream_interval':
netlib.c:(.text+0x3e09): undefined reference to `demo_interval_tick'
netlib.o: In function `demo_rr_interval':
netlib.c:(.text+0x3e7f): undefined reference to `demo_interval_tick'
nettest_omni.o: In function `send_omni_inner':
nettest_omni.c:(.text+0x83f0): undefined reference to `demo_interval_tick'
nettest_omni.c:(.text+0x8407): undefined reference to `demo_interval_tick'
nettest_omni.c:(.text+0x8430): undefined reference to `demo_interval_tick'
nettest_omni.o:nettest_omni.c:(.text+0x843c): more undefined references to `demo_interval_tick' follow
collect2: error: ld returned 1 exit status

Seems like the issue is related to this

My workaround and suggestion

By removing inline from the two places in src/netlib.c (here, and here), I could compile the source successfully.

As I am new to netperf, I am not sure if this is a genuine issue and my solution is acceptable. I assume those inline's are used for a good reason, and the compilation error is just due to my environment. If so, please close this issue and I do my workaround on my end.

However, if it makes sense to remove inline from these two places, and those inlines don't add much value currently (inline for performance optimization?), I can submit a pull request.

Thanks

krc commented 4 years ago

It's fixed for a long time on master, just no release has been made in all that time...

https://github.com/HewlettPackard/netperf/commit/40c8a0fb873ac07a95f0c0253b2bd66109aa4c51

detj commented 3 years ago

I faced the same error while compiling using brew install --build-from-source after editing the configure script using brew edit netperf.

Are there any plans to release a new version?

See #12