I recently started working on pktgen and got everything set up in Centos 7.9 on a server. Pktgen it self is running fine and lua is also working fine in system. Pktgen is able to detect and loading lua saying "lua enabled" and "Dependency lua found: YES 5.1.4 (cached)" but shows "lua_enabled: -Denable_lua=false". Also I edited the meson_option.txt to "option('enable_lua', type: 'boolean', value: true, description: 'Enable Lua support')" and rebuild with "meson -Denable_lua=true --reconfigure build". Still when I run the test hello world lua script with the following command inside pktgen console:
./usr/local/bin/pktgen -- -m "[2:4].0"
script test/hello-world.lua
I get the error:
User State for CLI not set for Lua, please build with Lua enabled
meson_options.txt
option('enable_lua', type: 'boolean', value: true, description: 'Enable Lua support')
option('enable_gui', type: 'boolean', value: false, description: 'build the gui')
option('enable_docs', type: 'boolean', value: false, description: 'build documentation')
option('enable-avx', type: 'boolean', value: true, description: 'Try to compile with AVX support')
option('enable-avx2', type: 'boolean', value: false, description: 'Try to compile with AVX2 support')
option('only_docs', type: 'boolean', value: false, description: 'Only build documentation')
meson.build
project('pktgen', 'C',
version: run_command(find_program('cat', 'more'),
files('VERSION'), check:false).stdout().strip(),
license: 'BSD',
default_options: [
'buildtype=release',
'default_library=static',
'warning_level=3',
'werror=true'
],
meson_version: '>= 0.47.1'
)
pktgen_conf = configuration_data()
# set up some global vars for compiler, platform, configuration, etc.
cc = meson.get_compiler('c')
target = target_machine.cpu_family()
if (target != 'riscv64')
add_project_arguments('-march=native', language: 'c')
endif
if get_option('enable-avx') and cc.has_argument('-mavx')
add_project_arguments('-mavx', language: 'c')
endif
if get_option('enable-avx2') and cc.has_argument('-mavx2')
add_project_arguments('-mavx', language: 'c')
endif
add_project_arguments('-DALLOW_EXPERIMENTAL_API', language: 'c')
add_project_arguments('-D_GNU_SOURCE', language: 'c')
# enable extra warnings and disable any unwanted warnings
warning_flags = [
'-Wno-pedantic',
'-Wno-format-truncation',
]
foreach arg: warning_flags
if cc.has_argument(arg)
add_project_arguments(arg, language: 'c')
endif
endforeach
lua_dep = dependency('', required: false)
if get_option('enable_lua')
message('>>>>>>>>>>>>> Lua enabled <<<<<<<<<<<<<<')
add_project_arguments('-DLUA_ENABLED', language: 'c')
lua_names = ['lua', 'lua-5.3', 'lua5.3', 'lua-5.4', 'lua5.4']
foreach n:lua_names
lua_dep = dependency(n, required: false)
if not lua_dep.found()
lua_dep = cc.find_library(n, required: false)
endif
if lua_dep.found()
break
endif
endforeach
if not lua_dep.found()
error('unable to find Lua')
endif
endif
if get_option('only_docs')
subdir('tools')
subdir('doc')
else
dpdk = dependency('libdpdk', required: true)
# message('prefix: ' + get_option('prefix') + ' libdir: ' + get_option('libdir'))
dpdk_libs_path = join_paths(get_option('prefix'), get_option('libdir'))
# message('DPDK lib path: ' + dpdk_libs_path)
dpdk_bond = cc.find_library('librte_net_bond', dirs: [dpdk_libs_path], required: false)
subdir('tools')
subdir('lib')
subdir('app')
subdir('doc')
endif
Make output
$ make
>>> Use 'make help' for more commands\n
./tools/pktgen-build.sh build
>> SDK Path : /home
>> Install Path : /home/pktgen-dpdk-pktgen-23.03.0
>> Build Directory : /home/pktgen-dpdk-pktgen-23.03.0/Builddir
>> Target Directory : usr/local
>> Build Path : /home/pktgen-dpdk-pktgen-23.03.0/Builddir
>> Target Path : /home/pktgen-dpdk-pktgen-23.03.0/usr/local
Build and install values:
lua_enabled : -Denable_lua=false
gui_enabled : -Denable_gui=false
>>> Ninja build in '/home/pktgen-dpdk-pktgen-23.03.0/Builddir' buildtype=release
meson -Dbuildtype=release -Denable_lua=false -Denable_gui=false /home/pktgen-dpdk-pktgen-23.03.0/Builddir
Directory already configured.
Just run your build command (e.g. ninja) and Meson will regenerate as necessary.
If ninja fails, run "ninja reconfigure" or "meson --reconfigure"
to force Meson to regenerate.
If build failures persist, run "meson setup --wipe" to rebuild from scratch
using the same options as passed when configuring the build.
To change option values, run "meson configure" instead.
ninja: Entering directory `/home/pktgen-dpdk-pktgen-23.03.0/Builddir'
[0/1] Regenerating build files.
The Meson build system
Version: 0.55.1
Source dir: /home/pktgen-dpdk-pktgen-23.03.0
Build dir: /home/pktgen-dpdk-pktgen-23.03.0/Builddir
Build type: native build
Program cat found: YES
Using 'PKG_CONFIG_PATH' from environment with value: '/usr/lib64/pkgconfig:/usr/local/lib64/pkgconfig:/opt/rh/devtoolset-8/root/usr/lib64/pkgconfig'
WARNING: PKG_CONFIG_PATH environment variable has changed between configurations, meson ignores this. Use -Dpkg_config_path to change pkg-config search path instead.
Using 'PKG_CONFIG_PATH' from environment with value: '/usr/lib64/pkgconfig:/usr/local/lib64/pkgconfig:/opt/rh/devtoolset-8/root/usr/lib64/pkgconfig'
WARNING: PKG_CONFIG_PATH environment variable has changed between configurations, meson ignores this. Use -Dpkg_config_path to change pkg-config search path instead.
Project name: pktgen
Project version: 23.03.0
C compiler for the host machine: cc (gcc 8.3.1 "cc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)")
C linker for the host machine: cc ld.bfd 2.30-55
Host machine cpu family: x86_64
Host machine cpu: x86_64
Compiler for C supports arguments -mavx: YES (cached)
Compiler for C supports arguments -mavx2: YES (cached)
Compiler for C supports arguments -Wno-pedantic -Wpedantic: YES (cached)
Compiler for C supports arguments -Wno-format-truncation -Wformat-truncation: YES (cached)
Dependency libdpdk found: YES 23.03.0 (cached)
Library librte_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
Dependency threads found: YES unknown (cached)
Library numa found: YES
Library pcap found: YES
Library dl found: YES
Library m found: YES
Program doxygen found: YES
Program generate_doxygen.sh found: YES
Program generate_examples.sh found: YES
Program doxy-html-custom.sh found: YES
Configuring doxy-api.conf using configuration
Program sphinx-build found: YES
Build targets in project: 12
Found ninja-1.10.2 at /usr/bin/ninja
ninja: no work to do.
>>> Ninja install to '/home/pktgen-dpdk-pktgen-23.03.0/usr/local'
ninja: Entering directory `/home/pktgen-dpdk-pktgen-23.03.0/Builddir'
[0/1] Installing files.
Installing app/pktgen to /home/pktgen-dpdk-pktgen-23.03.0/usr/local/bin
Installing /home/pktgen-dpdk-pktgen-23.03.0/doc/source/custom.css to /home/pktgen-dpdk-pktgen-23.03.0/usr/local/share/doc/dpdk/_static/css
Any help is greatly appreciated, thanks in advance.
Edit: meson -Denable_lua=true --reconfigure build
meson -Denable_lua=true --reconfigure build
The Meson build system
Version: 0.55.1
Source dir: /home/pktgen-dpdk-pktgen-23.03.0
Build dir: /home/pktgen-dpdk-pktgen-23.03.0/build
Build type: native build
Program cat found: YES
Using 'PKG_CONFIG_PATH' from environment with value: '/usr/lib64/pkgconfig:/usr/local/lib64/pkgconfig:/opt/rh/devtoolset-8/root/usr/lib64/pkgconfig'
WARNING: PKG_CONFIG_PATH environment variable has changed between configurations, meson ignores this. Use -Dpkg_config_path to change pkg-config search path instead.
Using 'PKG_CONFIG_PATH' from environment with value: '/usr/lib64/pkgconfig:/usr/local/lib64/pkgconfig:/opt/rh/devtoolset-8/root/usr/lib64/pkgconfig'
WARNING: PKG_CONFIG_PATH environment variable has changed between configurations, meson ignores this. Use -Dpkg_config_path to change pkg-config search path instead.
Project name: pktgen
Project version: 23.03.0
C compiler for the host machine: cc (gcc 8.3.1 "cc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)")
C linker for the host machine: cc ld.bfd 2.30-55
Host machine cpu family: x86_64
Host machine cpu: x86_64
Compiler for C supports arguments -mavx: YES (cached)
Compiler for C supports arguments -Wno-pedantic -Wpedantic: YES (cached)
Compiler for C supports arguments -Wno-format-truncation -Wformat-truncation: YES (cached)
Message: >>>>>>>>>>>>> Lua enabled <<<<<<<<<<<<<<
Dependency lua found: YES 5.1.4 (cached)
Dependency libdpdk found: YES 23.03.0 (cached)
Library librte_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
Dependency threads found: YES unknown (cached)
Library numa found: YES
Library pcap found: YES
Library dl found: YES
Library m found: YES
Program doxygen found: YES
Program generate_doxygen.sh found: YES
Program generate_examples.sh found: YES
Program doxy-html-custom.sh found: YES
Configuring doxy-api.conf using configuration
Program sphinx-build found: YES
Build targets in project: 12
Found ninja-1.10.2 at /usr/bin/ninja