Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to compile the pktperf example application #292

Open
expoli opened this issue Nov 4, 2024 · 7 comments
Open

How to compile the pktperf example application #292

expoli opened this issue Nov 4, 2024 · 7 comments

Comments

@expoli
Copy link

expoli commented Nov 4, 2024

Hello, I am new to this project. I would like to ask how to compile the pktperf application in examples. I did not find the corresponding guidance tutorial in the makefile or the docs guidance file of the program.

  • make help
[root@localhost Pktgen-DPDK]# make help
>>> Use 'make help' for more commands\n
./tools/pktgen-build.sh help
>>  SDK Path          : /root
>>  Install Path      : /root/Pktgen-DPDK
>>  Build Directory   : /root/Pktgen-DPDK/builddir
>>  Target Directory  : usr/local
>>  Build Path        : /root/Pktgen-DPDK/builddir
>>  Target Path       : /root/Pktgen-DPDK/usr/local

 Usage: Build Pktgen using Meson/Ninja tools
  ** Must be in the top level directory for Pktgen
     This tool is in tools/pktgen-build.sh, but use 'make' which calls this script
     Use 'make' to build Pktgen as it allows for multiple targets i.e. 'make clean debug'

  Command Options:
  <no args>   - create the '/root/Pktgen-DPDK/builddir' directory if not present and compile Pktgen
                If the '/root/Pktgen-DPDK/builddir' directory exists it will use ninja to build Pktgen without
                running meson unless one of the meson.build files were changed
  build       - same as 'make' with no arguments
  buildlua    - same as 'make build' except enable Lua build
  debug       - turn off optimization, may need to do 'clean' then 'debug' the first time
  debugopt    - turn optimization on with -O2, may need to do 'clean' then 'debugopt' the first time
  clean       - remove the following directory: /root/Pktgen-DPDK/builddir
  install     - install the includes/libraries into /root/Pktgen-DPDK/usr/local directory
  uninstall   - uninstall the includes/libraries into /root/Pktgen-DPDK/usr/local directory
  docs        - create the document files

 Build and install environment variables:
  PKTGEN_INSTALL_PATH - The install path, defaults to Pktgen SDK directory
  PKTGEN_TARGET       - The target directory appended to install path, defaults to 'usr'
  PKTGEN_BUILD        - The build directory appended to install path, default to 'builddir'
  PKTGEN_DESTDIR      - The install destination directory

 Build and install values:
   lua_enabled       : -Denable_lua=false
  • meson configure
[root@localhost builddir]# meson configure
Core properties:
  Source dir /root/Pktgen-DPDK
  Build dir  /root/Pktgen-DPDK/builddir

Main project options:
  
  Core options                      Current Value                       Possible Values                     Description
  ------------                      -------------                       ---------------                     -----------
  auto_features                     auto                                [enabled, disabled, auto]           Override value of all 'auto' features
  backend                           ninja                               [ninja, vs, vs2010, vs2012, vs2013, Backend to use
                                                                        vs2015, vs2017, vs2019,             
                                                                         xcode]                             
  buildtype                         release                             [plain, debug, debugoptimized,      Build type to use
                                                                        release, minsize, custom]           
  cmake_prefix_path                 []                                                                      List of additional prefixes for cmake to search
  debug                             false                               [true, false]                       Debug
  default_library                   static                              [shared, static, both]              Default library type
  force_fallback_for                []                                                                      Force fallback for those subprojects
  install_umask                     0022                                [preserve, 0000-0777]               Default umask to apply on permissions of installed files
  layout                            mirror                              [mirror, flat]                      Build directory layout
  optimization                      3                                   [0, g, 1, 2, 3, s]                  Optimization level
  pkg_config_path                   [/usr/local/lib64/pkgconfig]                                            List of additional paths for pkg-config to search
  strip                             false                               [true, false]                       Strip targets on install
  unity                             off                                 [on, off, subprojects]              Unity build
  unity_size                        4                                   >=2                                 Unity block size
  warning_level                     3                                   [0, 1, 2, 3]                        Compiler warning level to use
  werror                            true                                [true, false]                       Treat warnings as errors
  wrap_mode                         default                             [default, nofallback, nodownload,   Wrap mode
                                                                        forcefallback, nopromote]           
  
  Backend options                   Current Value                       Possible Values                     Description
  ---------------                   -------------                       ---------------                     -----------
  backend_max_links                 0                                   >=0                                 Maximum number of linker processes to run or 0 for no limit
  
  Base options                      Current Value                       Possible Values                     Description
  ------------                      -------------                       ---------------                     -----------
  b_asneeded                        true                                [true, false]                       Use -Wl,--as-needed when linking
  b_colorout                        always                              [auto, always, never]               Use colored output
  b_coverage                        false                               [true, false]                       Enable coverage tracking.
  b_lto                             false                               [true, false]                       Use link time optimization
  b_lto_threads                     0                                                                       Use multiple threads for Link Time Optimization
  b_lundef                          true                                [true, false]                       Use -Wl,--no-undefined when linking
  b_ndebug                          false                               [true, false, if-release]           Disable asserts
  b_pch                             true                                [true, false]                       Use precompiled headers
  b_pgo                             off                                 [off, generate, use]                Use profile guided optimization
  b_pie                             false                               [true, false]                       Build executables as position independent
  b_sanitize                        none                                [none, address, thread, undefined,  Code sanitizer to use
                                                                        memory, address,undefined]          
  b_staticpic                       true                                [true, false]                       Build static libraries as position independent
  
  Compiler options                  Current Value                       Possible Values                     Description
  ----------------                  -------------                       ---------------                     -----------
  c_args                            []                                                                      Extra arguments passed to the c compiler
  c_link_args                       []                                                                      Extra arguments passed to the c linker
  c_std                             none                                [none, c89, c99, c11, c17, c18,     C language standard to use
                                                                        c2x, gnu89, gnu99, gnu11,           
                                                                         gnu17, gnu18, gnu2x]               
  
  Directories                       Current Value                       Possible Values                     Description
  -----------                       -------------                       ---------------                     -----------
  prefix                            /usr/local                                                              Installation prefix
  bindir                            bin                                                                     Executable directory
  datadir                           share                                                                   Data file directory
  includedir                        include                                                                 Header file directory
  infodir                           share/info                                                              Info page directory
  libdir                            lib64                                                                   Library directory
  libexecdir                        libexec                                                                 Library executable directory
  localedir                         share/locale                                                            Locale data directory
  localstatedir                     /var/local                                                              Localstate data directory
  mandir                            share/man                                                               Manual page directory
  sbindir                           sbin                                                                    System executable directory
  sharedstatedir                    /var/local/lib                                                          Architecture-independent data directory
  sysconfdir                        etc                                                                     Sysconf data directory
  
  Testing options                   Current Value                       Possible Values                     Description
  ---------------                   -------------                       ---------------                     -----------
  errorlogs                         true                                [true, false]                       Whether to print the logs from failing tests
  stdsplit                          true                                [true, false]                       Split stdout and stderr in test logs
  
  Project options                   Current Value                       Possible Values                     Description
  ---------------                   -------------                       ---------------                     -----------
  enable-avx                        true                                [true, false]                       Try to compile with AVX support
  enable-avx2                       true                                [true, false]                       Try to compile with AVX2 support
  enable_docs                       false                               [true, false]                       build documentation
  enable_lua                        true                                [true, false]                       Enable Lua support
  only_docs                         false                               [true, false]                       Only build documentation
@expoli expoli changed the title How to compile the pktperf application How to compile the pktperf example application Nov 4, 2024
@KeithWiles
Copy link
Collaborator

The pktperf application is built when you do a make build or make rebuild.

I would pick make rebuild as it cleans and builds everything again. The binary is located in usr/local/bin/pktperf in the pktgen directory. I do not have a lot of documentation on pktperf as it is a simple tool.

@expoli
Copy link
Author

expoli commented Nov 5, 2024

I executed the make rebuild command in the main branch the way you said, and then tried to find the pktperf app in the usr/local/bin folder and found that there was only one pktgen app. Am I doing something wrong?

[root@localhost Pktgen-DPDK]# git status 
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean
[root@localhost Pktgen-DPDK]# make rebuild
>>> Use 'make help' for more commands\n
./tools/pktgen-build.sh clean build
>>  SDK Path          : /root
>>  Install Path      : /root/Pktgen-DPDK
>>  Build Directory   : /root/Pktgen-DPDK/builddir
>>  Target Directory  : usr/local
>>  Build Path        : /root/Pktgen-DPDK/builddir
>>  Target Path       : /root/Pktgen-DPDK/usr/local

 Build and install values:
   lua_enabled       : -Denable_lua=false

*** Removing '/root/Pktgen-DPDK/builddir' directory
 Build and install values:
   lua_enabled       : -Denable_lua=false

>>> Ninja build in '/root/Pktgen-DPDK/builddir' buildtype=release
meson setup -Dbuildtype=release -Denable_lua=false /root/Pktgen-DPDK/builddir
The Meson build system
Version: 0.59.4
Source dir: /root/Pktgen-DPDK
Build dir: /root/Pktgen-DPDK/builddir
Build type: native build
Program cat found: YES (/usr/bin/cat)
Project name: pktgen
Project version: 24.10.0
C compiler for the host machine: cc (gcc 10.3.1 "cc (GCC) 10.3.1")
C linker for the host machine: cc ld.bfd 2.37
Host machine cpu family: x86_64
Host machine cpu: x86_64
Compiler for C supports arguments -mavx: YES 
Compiler for C supports arguments -mavx2: YES 
Compiler for C supports arguments -Wno-pedantic: YES 
Compiler for C supports arguments -Wno-format-truncation: YES 
Found pkg-config: /usr/bin/pkg-config (1.8.0)
Found CMake: /usr/bin/cmake (3.22.0)
Run-time dependency libfgen found: NO (tried pkgconfig and cmake)
Run-time dependency libdpdk found: YES 24.11.0-rc1
Message: prefix: /usr/local libdir: lib64
Message: DPDK lib path: /usr/local/lib64
Library rte_net_bond found: YES
Program python3 found: YES (/usr/bin/python3)
Library rte_net_i40e found: YES
Library rte_net_ixgbe found: YES
Library rte_net_ice found: YES
Library rte_bus_vdev found: YES
Run-time dependency threads found: YES
Run-time dependency numa found: YES 2.0.16
Run-time dependency pcap found: YES 1.10.3
Library dl found: YES
Library m found: YES
Library bsd found: YES
Program doxygen found: NO
Program sphinx-build found: YES (/usr/bin/sphinx-build)
Program echo found: YES (/usr/bin/echo)
Build targets in project: 10

Found ninja-1.10.2 at /usr/bin/ninja
ninja: Entering directory `/root/Pktgen-DPDK/builddir'
[64/64] Linking target app/pktgen
>>> Ninja install to '/root/Pktgen-DPDK/usr/local'
ninja: Entering directory `/root/Pktgen-DPDK/builddir'
[0/1] Installing files.
Installing app/pktgen to /root/Pktgen-DPDK/usr/local/bin
Installing /root/Pktgen-DPDK/doc/source/custom.css to /root/Pktgen-DPDK/usr/local/share/doc/dpdk/_static/css
[root@localhost Pktgen-DPDK]# tree usr/local/bin/
usr/local/bin/
└── pktgen

0 directories, 1 file
[root@localhost Pktgen-DPDK]# tree usr/local
usr/local
├── bin
│   └── pktgen
└── share
    └── doc
        └── dpdk
            └── _static
                └── css
                    └── custom.css

6 directories, 2 files
[root@localhost Pktgen-DPDK]# 

@KeithWiles
Copy link
Collaborator

Here is my build.

I also did cd pktgen-dpdk; rm -fr usr/* to make sure the directory is empty, but this step should not be required

Pktgen version is 24.10.0, what version are you using? (cat VERSION file)

rkwiles@broadwell (main):.../intel/pktgen-dpdk$ make rebuild
>>> Use 'make help' for more commands

./tools/pktgen-build.sh clean build
>>  SDK Path          : /work/projects/intel
>>  Install Path      : /work/projects/intel/pktgen-dpdk
>>  Build Directory   : /work/projects/intel/pktgen-dpdk/builddir
>>  Target Directory  : usr/local
>>  Build Path        : /work/projects/intel/pktgen-dpdk/builddir
>>  Target Path       : /work/projects/intel/pktgen-dpdk/usr/local

 Build and install values:
   lua_enabled       : -Denable_lua=false

*** Removing '/work/projects/intel/pktgen-dpdk/builddir' directory
 Build and install values:
   lua_enabled       : -Denable_lua=false

>>> Ninja build in '/work/projects/intel/pktgen-dpdk/builddir' buildtype=release
meson setup -Dbuildtype=release -Denable_lua=false /work/projects/intel/pktgen-dpdk/builddir
The Meson build system
Version: 1.3.2
Source dir: /work/projects/intel/pktgen-dpdk
Build dir: /work/projects/intel/pktgen-dpdk/builddir
Build type: native build
Program cat found: YES (/bin/cat)
Project name: pktgen
Project version: 24.10.0
C compiler for the host machine: ccache cc (gcc 13.2.0 "cc (Ubuntu 13.2.0-23ubuntu4) 13.2.0")
C linker for the host machine: cc ld.bfd 2.42
Host machine cpu family: x86_64
Host machine cpu: x86_64
Compiler for C supports arguments -mavx: YES
Compiler for C supports arguments -mavx2: YES
Compiler for C supports arguments -Wno-pedantic: YES
Compiler for C supports arguments -Wno-format-truncation: YES
Found pkg-config: YES (/bin/pkg-config) 1.8.1
Run-time dependency libfgen found: YES 24.05.0
Run-time dependency libdpdk found: YES 24.11.0-rc1
Message: prefix: /usr/local libdir: lib/x86_64-linux-gnu
Message: DPDK lib path: /usr/local/lib/x86_64-linux-gnu
Library rte_net_bond found: YES
Program python3 found: YES (/usr/bin/python3)
Library rte_net_i40e found: YES
Library rte_net_ixgbe found: YES
Library rte_net_ice found: YES
Library rte_bus_vdev found: YES
Run-time dependency threads found: YES
Run-time dependency numa found: YES 2.0.18
Run-time dependency pcap found: YES 1.10.4
Library dl found: YES
Library m found: YES
Library rte_net_i40e found: YES
Library rte_net_ixgbe found: YES
Library rte_net_ice found: YES
Library rte_bus_vdev found: YES
Dependency threads found: YES unknown (cached)
Dependency numa found: YES 2.0.18 (cached)
Dependency pcap found: YES 1.10.4 (cached)
Library dl found: YES
Library m found: YES
Library bsd found: YES
Program doxygen found: YES (/bin/doxygen)
Program generate_doxygen.sh found: YES (/work/projects/intel/pktgen-dpdk/doc/api/generate_doxygen.sh)
Program generate_examples.sh found: YES (/work/projects/intel/pktgen-dpdk/doc/api/generate_examples.sh)
Program doxy-html-custom.sh found: YES (/work/projects/intel/pktgen-dpdk/doc/api/doxy-html-custom.sh)
doc/api/meson.build:27: WARNING: Project targets '>= 0.58.0' but uses feature deprecated since '0.56.0': meson.source_root. use meson.project_source_root() or meson.global_source_root() instead.
doc/api/meson.build:35: WARNING: Project targets '>= 0.58.0' but uses feature deprecated since '0.56.0': meson.build_root. use meson.project_build_root() or meson.global_build_root() instead.
doc/api/meson.build:36: WARNING: Project targets '>= 0.58.0' but uses feature deprecated since '0.56.0': meson.build_root. use meson.project_build_root() or meson.global_build_root() instead.
doc/api/meson.build:38: WARNING: Project targets '>= 0.58.0' but uses feature deprecated since '0.56.0': meson.source_root. use meson.project_source_root() or meson.global_source_root() instead.
doc/api/meson.build:39: WARNING: Project targets '>= 0.58.0' but uses feature deprecated since '0.56.0': meson.source_root. use meson.project_source_root() or meson.global_source_root() instead.
Configuring doxy-api.conf using configuration
Program sphinx-build found: YES (/bin/sphinx-build)
Build targets in project: 13
WARNING: Deprecated features used:
 * 0.56.0: {'meson.build_root', 'meson.source_root'}

pktgen 24.10.0

  User defined options
    buildtype : release
    enable_lua: false

Found ninja-1.11.1 at /bin/ninja
ninja: Entering directory `/work/projects/intel/pktgen-dpdk/builddir'
[70/70] Linking target app/pktgen
>>> Ninja install to '/work/projects/intel/pktgen-dpdk/usr/local'
ninja: Entering directory `/work/projects/intel/pktgen-dpdk/builddir'
[0/1] Installing files.
Installing examples/pktperf/pktperf to /work/projects/intel/pktgen-dpdk/usr/local/bin
Installing app/pktgen to /work/projects/intel/pktgen-dpdk/usr/local/bin
Installing /work/projects/intel/pktgen-dpdk/doc/source/custom.css to /work/projects/intel/pktgen-dpdk/usr/local/share/doc/dpdk/_static/css
rkwiles@broadwell (main):.../intel/pktgen-dpdk$ tree usr
usr
└── local
    ├── bin
    │   ├── pktgen
    │   └── pktperf
    └── share
        └── doc
            └── dpdk
                └── _static
                    └── css
                        └── custom.css

@expoli
Copy link
Author

expoli commented Nov 6, 2024

interesting
thanks for you help, i will try it again.

i use version 24.10.0 too

[root@localhost Pktgen-DPDK]# git pull 
Already up to date.
[root@localhost Pktgen-DPDK]# git status 
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean
[root@localhost Pktgen-DPDK]# cat VERSION 
24.10.0
[root@localhost Pktgen-DPDK]# 

@expoli
Copy link
Author

expoli commented Nov 6, 2024

I found that the build output complained to me that the libfgen runtime did not exist. Is this the reason?

i try to rebuild this project, However, the pktperf tool is still not built successfully, which is very strange.

[root@localhost Pktgen-DPDK]# make rebuild
>>> Use 'make help' for more commands\n
./tools/pktgen-build.sh clean build
>>  SDK Path          : /root
>>  Install Path      : /root/Pktgen-DPDK
>>  Build Directory   : /root/Pktgen-DPDK/builddir
>>  Target Directory  : usr/local
>>  Build Path        : /root/Pktgen-DPDK/builddir
>>  Target Path       : /root/Pktgen-DPDK/usr/local

 Build and install values:
   lua_enabled       : -Denable_lua=false

*** Removing '/root/Pktgen-DPDK/builddir' directory
 Build and install values:
   lua_enabled       : -Denable_lua=false

>>> Ninja build in '/root/Pktgen-DPDK/builddir' buildtype=release
meson setup -Dbuildtype=release -Denable_lua=false /root/Pktgen-DPDK/builddir
The Meson build system
Version: 0.59.4
Source dir: /root/Pktgen-DPDK
Build dir: /root/Pktgen-DPDK/builddir
Build type: native build
Program cat found: YES (/usr/bin/cat)
Project name: pktgen
Project version: 24.10.0
C compiler for the host machine: cc (gcc 10.3.1 "cc (GCC) 10.3.1")
C linker for the host machine: cc ld.bfd 2.37
Host machine cpu family: x86_64
Host machine cpu: x86_64
Compiler for C supports arguments -mavx: YES 
Compiler for C supports arguments -mavx2: YES 
Compiler for C supports arguments -Wno-pedantic: YES 
Compiler for C supports arguments -Wno-format-truncation: YES 
Found pkg-config: /usr/bin/pkg-config (1.8.0)
Found CMake: /usr/bin/cmake (3.22.0)
Run-time dependency libfgen found: NO (tried pkgconfig and cmake)
Run-time dependency libdpdk found: YES 24.11.0-rc1
Message: prefix: /usr/local libdir: lib64
Message: DPDK lib path: /usr/local/lib64
Library rte_net_bond found: YES
Program python3 found: YES (/usr/bin/python3)
Library rte_net_i40e found: YES
Library rte_net_ixgbe found: YES
Library rte_net_ice found: YES
Library rte_bus_vdev found: YES
Run-time dependency threads found: YES
Run-time dependency numa found: YES 2.0.16
Run-time dependency pcap found: YES 1.10.3
Library dl found: YES
Library m found: YES
Library bsd found: YES
Program doxygen found: YES (/usr/bin/doxygen)
Program generate_doxygen.sh found: YES (/root/Pktgen-DPDK/doc/api/generate_doxygen.sh)
Program generate_examples.sh found: YES (/root/Pktgen-DPDK/doc/api/generate_examples.sh)
Program doxy-html-custom.sh found: YES (/root/Pktgen-DPDK/doc/api/doxy-html-custom.sh)
WARNING: Project targeting '>= 0.58.0' but tried to use feature deprecated since '0.56.0': meson.source_root. use meson.project_source_root() or meson.global_source_root() instead.
WARNING: Project targeting '>= 0.58.0' but tried to use feature deprecated since '0.56.0': meson.build_root. use meson.project_build_root() or meson.global_build_root() instead.
Configuring doxy-api.conf using configuration
Program sphinx-build found: YES (/usr/bin/sphinx-build)
Program echo found: YES (/usr/bin/echo)
Build targets in project: 12
WARNING: Deprecated features used:
 * 0.56.0: {'meson.build_root', 'meson.source_root'}

Found ninja-1.10.2 at /usr/bin/ninja
ninja: Entering directory `/root/Pktgen-DPDK/builddir'
[64/64] Linking target app/pktgen
>>> Ninja install to '/root/Pktgen-DPDK/usr/local'
ninja: Entering directory `/root/Pktgen-DPDK/builddir'
[0/1] Installing files.
Installing app/pktgen to /root/Pktgen-DPDK/usr/local/bin
Installing /root/Pktgen-DPDK/doc/source/custom.css to /root/Pktgen-DPDK/usr/local/share/doc/dpdk/_static/css

@KeithWiles
Copy link
Collaborator

Sorry, I have not finished the fgen library and I need to do a bit of cleanup before I can release it.

The fgen code is located here https://github.com/pktgen/fgen if you want to look at it. I will fixup and release it at some point. The fgen repo does contain example code, but it needs to be cleaned up a fair bit. I would suggest you wait until it is released.

@expoli
Copy link
Author

expoli commented Nov 7, 2024

Ok, thank you very much for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants