简体   繁体   中英

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

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 Getting Started with Pktgen and I get the error message after I have cd into the pktgen repo and run make . Before that I have run the following in the dpdk-stable-22.11.1 directory.

  meson build
  ninja -C build

I have also setup hugepages.

The error seems to suggest there is something wrong with the code inside of Pktgen which seems unlikely. When I go into the file pg_strings.c and include ctype.h , then run make again, it does not give me an error for those files anymore but instead find some issue within another file etc. So it seems like something is very wrong. Any ideas on what might be the cause of this?

I'm also running this in Virtualbox with Ubuntu 22.04 if that is relevant for the issue.

UPDATE:

To clarify if I include ctype.h I get a new error which says:

新错误

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 .

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, eg:
    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, eg 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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM