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
874 stars 187 forks source link

Unable to compile on Fedora 32 #42

Open huaracheguarache opened 4 years ago

huaracheguarache commented 4 years ago

As the title states, I'm unable to compile netperf on Fedora 32. What I've done so far is run (without any apparent issues):

./autogen.sh
./configure --enable-demo

When I run make I get the following error:

[michael@localhost netperf]$ make
(CDPATH="${ZSH_VERSION+.}:" && cd . && autoheader)
rm -f stamp-h1
touch config.h.in
cd . && /bin/sh ./config.status config.h
config.status: creating config.h
config.status: config.h is unchanged
make  all-recursive
make[1]: Entering directory '/home/michael/src/router_stuff/netperf'
Making all in src
make[2]: Entering directory '/home/michael/src/router_stuff/netperf/src'
Making all in missing
make[3]: Entering directory '/home/michael/src/router_stuff/netperf/src/missing'
Making all in m4
make[4]: Entering directory '/home/michael/src/router_stuff/netperf/src/missing/m4'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/michael/src/router_stuff/netperf/src/missing/m4'
make[4]: Entering directory '/home/michael/src/router_stuff/netperf/src/missing'
make[4]: Nothing to be done for 'all-am'.
make[4]: Leaving directory '/home/michael/src/router_stuff/netperf/src/missing'
make[3]: Leaving directory '/home/michael/src/router_stuff/netperf/src/missing'
make[3]: Entering directory '/home/michael/src/router_stuff/netperf/src'
gcc -DHAVE_CONFIG_H -I. -I..      -MT netperf.o -MD -MP -MF .deps/netperf.Tpo -c -o netperf.o netperf.c
mv -f .deps/netperf.Tpo .deps/netperf.Po
gcc -DHAVE_CONFIG_H -I. -I..      -MT netlib.o -MD -MP -MF .deps/netlib.Tpo -c -o netlib.o netlib.c
netlib.c: In function ‘bind_to_specific_processor’:
netlib.c:2343:9: warning: implicit declaration of function ‘sched_setaffinity’; did you mean ‘SYS_sched_setaffinity’? [-Wimplicit-function-declaration]
 2343 |     if (sched_setaffinity(getpid(), len, &netperf_cpu_set)) {
      |         ^~~~~~~~~~~~~~~~~
      |         SYS_sched_setaffinity
mv -f .deps/netlib.Tpo .deps/netlib.Po
gcc -DHAVE_CONFIG_H -I. -I..      -MT netsh.o -MD -MP -MF .deps/netsh.Tpo -c -o netsh.o netsh.c
mv -f .deps/netsh.Tpo .deps/netsh.Po
gcc -DHAVE_CONFIG_H -I. -I..      -MT nettest_bsd.o -MD -MP -MF .deps/nettest_bsd.Tpo -c -o nettest_bsd.o nettest_bsd.c
mv -f .deps/nettest_bsd.Tpo .deps/nettest_bsd.Po
gcc -DHAVE_CONFIG_H -I. -I..      -MT nettest_dlpi.o -MD -MP -MF .deps/nettest_dlpi.Tpo -c -o nettest_dlpi.o nettest_dlpi.c
mv -f .deps/nettest_dlpi.Tpo .deps/nettest_dlpi.Po
gcc -DHAVE_CONFIG_H -I. -I..      -MT nettest_unix.o -MD -MP -MF .deps/nettest_unix.Tpo -c -o nettest_unix.o nettest_unix.c
mv -f .deps/nettest_unix.Tpo .deps/nettest_unix.Po
gcc -DHAVE_CONFIG_H -I. -I..      -MT nettest_xti.o -MD -MP -MF .deps/nettest_xti.Tpo -c -o nettest_xti.o nettest_xti.c
mv -f .deps/nettest_xti.Tpo .deps/nettest_xti.Po
gcc -DHAVE_CONFIG_H -I. -I..      -MT nettest_sctp.o -MD -MP -MF .deps/nettest_sctp.Tpo -c -o nettest_sctp.o nettest_sctp.c
mv -f .deps/nettest_sctp.Tpo .deps/nettest_sctp.Po
gcc -DHAVE_CONFIG_H -I. -I..      -MT nettest_sdp.o -MD -MP -MF .deps/nettest_sdp.Tpo -c -o nettest_sdp.o nettest_sdp.c
mv -f .deps/nettest_sdp.Tpo .deps/nettest_sdp.Po
gcc -DHAVE_CONFIG_H -I. -I..      -MT nettest_omni.o -MD -MP -MF .deps/nettest_omni.Tpo -c -o nettest_omni.o nettest_omni.c
nettest_omni.c: In function ‘recv_data_no_copy’:
nettest_omni.c:3140:19: warning: implicit declaration of function ‘splice’ [-Wimplicit-function-declaration]
 3140 |     bytes_recvd = splice(data_socket,
      |                   ^~~~~~
mv -f .deps/nettest_omni.Tpo .deps/nettest_omni.Po
gcc -DHAVE_CONFIG_H -I. -I..      -MT net_uuid.o -MD -MP -MF .deps/net_uuid.Tpo -c -o net_uuid.o net_uuid.c
mv -f .deps/net_uuid.Tpo .deps/net_uuid.Po
gcc -DHAVE_CONFIG_H -I. -I..      -MT dscp.o -MD -MP -MF .deps/dscp.Tpo -c -o dscp.o dscp.c
mv -f .deps/dscp.Tpo .deps/dscp.Po
gcc -DHAVE_CONFIG_H -I. -I..      -MT netcpu_procstat.o -MD -MP -MF .deps/netcpu_procstat.Tpo -c -o netcpu_procstat.o netcpu_procstat.c
mv -f .deps/netcpu_procstat.Tpo .deps/netcpu_procstat.Po
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  -lrt -lm 
/usr/bin/ld: nettest_omni.o:(.bss+0x208): multiple definition of `loc_nodelay'; nettest_bsd.o:(.bss+0x20): first defined here
/usr/bin/ld: nettest_omni.o:(.bss+0x20c): multiple definition of `rem_nodelay'; nettest_bsd.o:(.bss+0x24): first defined here
/usr/bin/ld: nettest_omni.o:(.bss+0x210): multiple definition of `loc_sndavoid'; nettest_bsd.o:(.bss+0x40): first defined here
/usr/bin/ld: nettest_omni.o:(.bss+0x214): multiple definition of `loc_rcvavoid'; nettest_bsd.o:(.bss+0x44): first defined here
/usr/bin/ld: nettest_omni.o:(.bss+0x218): multiple definition of `rem_sndavoid'; nettest_bsd.o:(.bss+0x48): first defined here
/usr/bin/ld: nettest_omni.o:(.bss+0x21c): multiple definition of `rem_rcvavoid'; nettest_bsd.o:(.bss+0x4c): first defined here
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:419: netperf] Error 1
make[3]: Leaving directory '/home/michael/src/router_stuff/netperf/src'
make[2]: *** [Makefile:473: all-recursive] Error 1
make[2]: Leaving directory '/home/michael/src/router_stuff/netperf/src'
make[1]: *** [Makefile:374: all-recursive] Error 1
make[1]: Leaving directory '/home/michael/src/router_stuff/netperf'
make: *** [Makefile:313: all] Error 2
huaracheguarache commented 4 years ago

Ok, I got it to work. Fedora 32 uses GCC 10 which by default compiles with -fno-common. As a workaround you can pass -fcommon to GCC via make:

make CFLAGS="-fcommon"

I found this workaround here: https://gcc.gnu.org/gcc-10/porting_to.html

itayave commented 4 years ago

Thanks, Are you planning to provide a fix? if so, when?

huaracheguarache commented 4 years ago

@itayave Fixing the source code? I don't plan on doing that since I have no experience with C.

guidosarducci commented 4 years ago

Regarding a code fix, see https://github.com/openwrt/packages/pull/13058 as an example.

westurner commented 3 years ago

Would https://github.com/HewlettPackard/netperf/pull/46 "nettest_omni: Remove duplicate variable definitions" fix this issue as well?

westurner commented 3 years ago

Note that I'm ~still unable to compile~ now able to compile on FC34 with ~this Dockerfile:


# RUN dnf install -y [...]

## Install dotfiles
ARG uid=1000
ARG user="appuser"
ARG home="/home/${user}"
ARG __wrk="${home}/-wrk"
ARG workon_home="${__wrk}/-ve39"
ARG venvname="turnernet"
ARG project="${__wrk}/${venvname}"
ARG virtual_env="${workon_home}/${venvname}"

# Install flent (requires netperf)
RUN HOME="${home}" \
    PATH="${home}/.local/bin:${PATH}" \
    python -m pip install --user flent && \
    cd "${__wrk}" && \
    (test -d netperf \
      || git clone https://github.com/HewlettPackard/netperf) && \
    cd netperf && \
    ./autogen.sh && \
    ./configure --enable-demo --prefix=/usr/local
USER root
RUN make -C "${__wrk}/netperf" CFLAGS="-fcommon" && make -C "${__wrk}/netperf" install

USER 1000
# COPY --chown=${user} \
COPY --chown=1000:1000 \
     requirements.txt requirements_dev.txt "${__wrk}/"
RUN python3 -m venv "${virtual_env}" \
    && "${virtual_env}/bin/python" -m pip install \
    -r "${__wrk}/requirements_dev.txt" \
    -r "${__wrk}/requirements.txt" \
    notebook jupyterlab jupyter_contrib_nbextensions \
    flent matplotlib \
    pandas
EXPOSE 18888/tcp