emmericp / MoonGen

MoonGen is a fully scriptable high-speed packet generator built on DPDK and LuaJIT. It can saturate a 10 Gbit/s connection with 64 byte packets on a single CPU core while executing user-provided Lua scripts for each packet. Multi-core support allows for even higher rates. It also features precise and accurate timestamping and rate control.
MIT License
1.03k stars 234 forks source link

Cannot compile moongen from github on Centos 8 #321

Open rafaelfolco opened 2 years ago

rafaelfolco commented 2 years ago

This issue is probably a dup of #169 I am opening a new issue since the suggestion on #169 to disable KNI mod doesn't work. Also, I am running centos8.

<..>
-- Generating done
-- Build files have been written to: /MoonGen/libmoon/build
[ 14%] Building C object CMakeFiles/libmoon.dir/src/memory.c.o
[ 14%] Building CXX object CMakeFiles/libmoon.dir/src/main.cpp.o
[ 14%] Building CXX object CMakeFiles/libmoon.dir/src/task.cpp.o
[ 19%] Building C object CMakeFiles/libmoon.dir/src/device.c.o
[ 28%] Building C object CMakeFiles/libmoon.dir/src/i40e.c.o
[ 28%] Building C object CMakeFiles/libmoon.dir/src/util.c.o
[ 33%] Building CXX object CMakeFiles/libmoon.dir/src/lifecycle.cpp.o
[ 38%] Building CXX object CMakeFiles/libmoon.dir/src/barrier.cpp.o
/MoonGen/libmoon/src/memory.c:2:10: fatal error: rte_mbuf.h: No such file or directory
 #include <rte_mbuf.h>
          ^~~~~~~~~~~~
compilation terminated.
/MoonGen/libmoon/src/i40e.c:2:10: fatal error: rte_ethdev.h: No such file or directory
 #include <rte_ethdev.h>
          ^~~~~~~~~~~~~~
compilation terminated.
/MoonGen/libmoon/src/device.c:2:10: fatal error: rte_ethdev.h: No such file or directory
 #include <rte_ethdev.h>
          ^~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/libmoon.dir/build.make:90: CMakeFiles/libmoon.dir/src/memory.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [CMakeFiles/libmoon.dir/build.make:132: CMakeFiles/libmoon.dir/src/i40e.c.o] Error 1
make[2]: *** [CMakeFiles/libmoon.dir/build.make:118: CMakeFiles/libmoon.dir/src/device.c.o] Error 1
/MoonGen/libmoon/src/util.c:3:10: fatal error: rte_ip.h: No such file or directory
 #include <rte_ip.h>
          ^~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/libmoon.dir/build.make:146: CMakeFiles/libmoon.dir/src/util.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/libmoon.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

I was actually able to get to the end of the build after doing two hacks. However, I am looking for ideas on what changes are required for a proper fix in the automated build. My workaround was to copy the "missing" headers to the build dir:

            cp ./libmoon/deps/dpdk/lib/librte_mempool/rte_mempool.h ./libmoon/deps/dpdk/x86_64-native-linuxapp-gcc/include/
            cp ./libmoon/deps/dpdk/lib/librte_net/rte_ether.h ./libmoon/deps/dpdk/x86_64-native-linuxapp-gcc/include/
            cp ./libmoon/deps/dpdk/lib/librte_ring/rte_ring.h ./libmoon/deps/dpdk/x86_64-native-linuxapp-gcc/include/
            cp ./libmoon/deps/dpdk/lib/librte_net/rte_ip.h ./libmoon/deps/dpdk/x86_64-native-linuxapp-gcc/include/
            cp ./libmoon/deps/dpdk/lib/librte_mbuf/rte_mbuf_ptype.h ./libmoon/deps/dpdk/x86_64-native-linuxapp-gcc/include/
            cp ./libmoon/deps/dpdk/lib/librte_ether/rte_eth_ctrl.h ./libmoon/deps/dpdk/x86_64-native-linuxapp-gcc/include/
            cp ./libmoon/deps/dpdk/lib/librte_kni/rte_kni.h ./libmoon/deps/dpdk/x86_64-native-linuxapp-gcc/include/
            cp ./libmoon/deps/dpdk/lib/librte_net/rte_udp.h ./libmoon/deps/dpdk/x86_64-native-linuxapp-gcc/include/
            cp ./libmoon/deps/dpdk/lib/librte_ether/rte_dev_info.h ./libmoon/deps/dpdk/x86_64-native-linuxapp-gcc/include/
            cp ./libmoon/deps/dpdk/lib/librte_kvargs/rte_kvargs.h ./libmoon/deps/dpdk/x86_64-native-linuxapp-gcc/include/
            cp ./libmoon/deps/dpdk/lib/librte_hash/rte_hash.h ./libmoon/deps/dpdk/x86_64-native-linuxapp-gcc/include/
            cp ./libmoon/deps/dpdk/lib/librte_ether/rte_tm_driver.h ./libmoon/deps/dpdk/x86_64-native-linuxapp-gcc/include/
            cp ./libmoon/deps/dpdk/lib/librte_ether/rte_flow_driver.h ./libmoon/deps/dpdk/x86_64-native-linuxapp-gcc/include/
            cp ./libmoon/deps/dpdk/lib/librte_ether/rte_flow.h ./libmoon/deps/dpdk/x86_64-native-linuxapp-gcc/include/
            cp ./libmoon/deps/dpdk/lib/librte_ether/rte_tm.h ./libmoon/deps/dpdk/x86_64-native-linuxapp-gcc/include/
            cp ./libmoon/deps/dpdk/lib/librte_net/rte_arp.h ./libmoon/deps/dpdk/x86_64-native-linuxapp-gcc/include/
            cp ./libmoon/deps/dpdk/lib/librte_net/rte_icmp.h ./libmoon/deps/dpdk/x86_64-native-linuxapp-gcc/include/
            cp ./libmoon/deps/dpdk/lib/librte_net/rte_sctp.h ./libmoon/deps/dpdk/x86_64-native-linuxapp-gcc/include/
            cp ./libmoon/deps/dpdk/lib/librte_net/rte_tcp.h ./libmoon/deps/dpdk/x86_64-native-linuxapp-gcc/include/

The 2nd hack was to disable some config settings:

            sed -i -r 's/CONFIG_RTE_EAL_IGB_UIO=y/CONFIG_RTE_EAL_IGB_UIO=n/' libmoon/deps/dpdk/config/common_linuxapp
            sed -i -r 's/CONFIG_RTE_LIBRTE_KNI=y/CONFIG_RTE_LIBRTE_KNI=n/' libmoon/deps/dpdk/config/common_linuxapp
            sed -i -r 's/CONFIG_RTE_LIBRTE_PMD_KNI=y/CONFIG_RTE_LIBRTE_PMD_KNI=n/' libmoon/deps/dpdk/config/common_linuxapp
            sed -i -r 's/CONFIG_RTE_LIBRTE_VHOST=y/CONFIG_RTE_LIBRTE_VHOST=n/' libmoon/deps/dpdk/config/common_linuxapp
            sed -i -r 's/CONFIG_RTE_LIBRTE_VHOST_NUMA=y/CONFIG_RTE_LIBRTE_VHOST_NUMA=n/' libmoon/deps/dpdk/config/common_linuxapp
            sed -i -r 's/CONFIG_RTE_LIBRTE_PMD_VHOST=y/CONFIG_RTE_LIBRTE_PMD_VHOST=n/' libmoon/deps/dpdk/config/common_linuxapp
            sed -i -r 's/CONFIG_RTE_LIBRTE_PMD_TAP=y/CONFIG_RTE_LIBRTE_PMD_TAP=n/' libmoon/deps/dpdk/config/common_linuxapp
            sed -i -r 's/CONFIG_RTE_LIBRTE_AVP_PMD=y/CONFIG_RTE_LIBRTE_AVP_PMD=n/' libmoon/deps/dpdk/config/common_linuxapp

Would you please point me to the Makefile or script to fix this issue ?

Thanks.

rafaelfolco commented 2 years ago

@emmericp Would you have any ideas why the .h files from ./libmoon/deps/dpdk/lib are not copied/symlinked to the target build dir at ./libmoon/deps/dpdk/x86_64-native-linuxapp-gcc/include/ ? Thanks in advance

Rwolkenflitzer commented 1 year ago

Thanks for your hacks, helped me with this issue on ubuntu 20.04.

msherif1234 commented 1 year ago

Thanks that help me compile on ubuntu 22.04 as well just needed to add

cp ./libmoon/deps/dpdk/lib/librte_kni/rte_kni.h ./libmoon/deps/dpdk/x86_64-native-linuxapp-gcc/include/

but I have linker issues now that need to figure out

100%] Linking CXX executable MoonGen
/usr/bin/ld: cannot find -lrte_pmd_bond: No such file or directory
/usr/bin/ld: cannot find -lrte_pmd_ring: No such file or directory
/usr/bin/ld: cannot find -lrte_pmd_e1000: No such file or directory
/usr/bin/ld: cannot find -lrte_pmd_virtio: No such file or directory
/usr/bin/ld: cannot find -lrte_pmd_i40e: No such file or directory
/usr/bin/ld: cannot find -lrte_pmd_vmxnet3_uio: No such file or directory
/usr/bin/ld: cannot find -lrte_pmd_ixgbe: No such file or directory
/usr/bin/ld: cannot find -lrte_pmd_bnxt: No such file or directory
/usr/bin/ld: cannot find -lrte_pmd_ena: No such file or directory
/usr/bin/ld: cannot find -lrte_pmd_nfp: No such file or directory
/usr/bin/ld: cannot find -lrte_pmd_mlx5: No such file or directory
collect2: error: ld returned 1 exit status
Dhyey-Thummar commented 1 year ago

@msherif1234 Were you able to fix it? I am running into the same issue.

g83wang commented 1 year ago

@Dhyey-Thummar & @msherif1234

I am also running into the issue. Wondering if we have found a fix for it?

Thank you.

Dhyey-Thummar commented 1 year ago

@g83wang , unfortunately not. The compilation issue still persists. We really wanted to try this, but were not successful. We switched over to using pktGen and trex traffic generator.