Skip to content

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

@richardimaoka

Description

@richardimaoka

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:

  • I wanted to compile netperf with --enable-demo
  • So I downloaded the netperf-2.7.0 source package from GitHub, and tried to compile it on Amazon Linux 2 on Amazon EC2
  • However, I encountered the compilation error in the make step:
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions