Home > OS >  Pktgen fails to compile - Error: include ‘<ctype.h>’ or provide a declaration of ‘isspace’ / ’
Pktgen fails to compile - Error: include ‘<ctype.h>’ or provide a declaration of ‘isspace’ / ’

Time:01-27

I'm trying to compile pktgen, but keep getting this error when I try to compile:

pktgen

The DPDK version I'm running is dpdk-stable-22.11.1 and I'm following the official guide new error

And if I fix this error I come to another file where I have to fix another error and so on. Therefore, I cannot simply include ctype.

CodePudding user response:

Most of the issues related to using pktgen 22.04.01 with the latest DPDK 22.11.1 are referenced (indirectly, of course) in the DPDK release file, which can be found at doc/guides/rel_notes/release_22_11.rst (or here)

The main issue appears to be how they've reworked their BUS / PCI libraries, and correspondingly the headers.

There are two things you'll have to do differently than the basic setup steps:

  1. build DPDK with the enable_driver_sdk option, e.g.:
    meson -Dexamples=all -Denable_driver_sdk=true build
    ninja -C build
    sudo ninja install

-Dexamples=all isn't necessary, but gives you the example programs. The crucial part is the -Denable_driver_sdk=true, which will add capability and install a few header files that wouldn't exist otherwise, e.g. bus_driver.h

  1. Update their pktgen code so it compiles:
  • lib/common/pg_strings.h: add #include <ctype.h>
  • app/pktgen-port-cfg.h: comment out the line {RTE_ETH_RX_OFFLOAD_HEADER_SPLIT, _(HEADER_SPLIT)}, (It may be the case that RTE_ETH_RX_OFFLOAD_HEADER_SPLIT could simply be substituted with RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT, but that may be an incomplete fix. If you plan to offload RX header splitting to the hardware, you'll want to make sure this is properly working)
  • app/pktgen-port-cfg.c: comment out .split_hdr_size = 0
  • every file with #include <rte_bus_pci.h> (app/pktgen-latency.c, app/pktgen-port-cfg.c, app/pktgen-stats.c, app/pktgen-rate.c): add the following:
    #include <rte_bus.h>
    #include <bus_pci_driver.h>
    #include <bus_driver.h>
  • Related