Compilation of dpdk-pktgen

205 Views Asked by At

I am currently using DPDK 23.03 and pktgen version 23.06.1, GCC 4.8.5, and pkg-config version is (0.29.2) on centOS 7.9

No issue in compilation of DPDK. After compiling DPDK and setting PKT_CONFIG_PATH, output seems to be good as expected.

pkg-config --static --cflags --libs libdpdk

-include rte_config.h -march=native -mno-avx512f -I/root/install/include -L/root/install/lib64 -L/usr/lib64 -Wl,--whole-archive -l:librte_common_cpt.a -l:librte_common_dpaax.a -l:librte_common_iavf.a -l:librte_common_idpf.a -l:librte_common_octeontx.a -l:librte_bus_auxiliary.a -l:librte_bus_dpaa.a -l:librte_bus_fslmc.a -l:librte_bus_ifpga.a -l:librte_bus_pci.a -l:librte_bus_platform.a -l:librte_bus_vdev.a -l:librte_bus_vmbus.a -l:librte_common_cnxk.a -l:librte_common_qat.a -l:librte_common_sfc_efx.a -l:librte_mempool_bucket.a -l:librte_mempool_cnxk.a -l:librte_mempool_dpaa.a -l:librte_mempool_dpaa2.a -l:librte_mempool_octeontx.a -l:librte_mempool_ring.a -l:librte_mempool_stack.a -l:librte_dma_cnxk.a -l:librte_dma_dpaa.a -l:librte_dma_dpaa2.a -l:librte_dma_hisilicon.a -l:librte_dma_idxd.a -l:librte_dma_ioat.a -l:librte_dma_skeleton.a -l:librte_net_af_packet.a -l:librte_net_ark.a -l:librte_net_atlantic.a -l:librte_net_avp.a -l:librte_net_axgbe.a -l:librte_net_bnx2x.a -l:librte_net_bnxt.a -l:librte_net_bond.a -l:librte_net_cnxk.a -l:librte_net_cpfl.a -l:librte_net_cxgbe.a -l:librte_net_dpaa.a -l:librte_net_dpaa2.a -l:librte_net_e1000.a -l:librte_net_ena.a -l:librte_net_enetc.a -l:librte_net_enetfec.a -l:librte_net_enic.a -l:librte_net_failsafe.a -l:librte_net_fm10k.a -l:librte_net_gve.a -l:librte_net_hinic.a -l:librte_net_hns3.a -l:librte_net_i40e.a -l:librte_net_iavf.a -l:librte_net_ice.a -l:librte_net_idpf.a -l:librte_net_igc.a -l:librte_net_ionic.a -l:librte_net_ixgbe.a -l:librte_net_liquidio.a -l:librte_net_memif.a -l:librte_net_netvsc.a -l:librte_net_nfp.a -l:librte_net_ngbe.a -l:librte_net_null.a -l:librte_net_octeontx.a -l:librte_net_octeon_ep.a -l:librte_net_pcap.a -l:librte_net_pfe.a -l:librte_net_qede.a -l:librte_net_ring.a -l:librte_net_sfc.a -l:librte_net_softnic.a -l:librte_net_tap.a -l:librte_net_thunderx.a -l:librte_net_txgbe.a -l:librte_net_vdev_netvsc.a -l:librte_net_vhost.a -l:librte_net_virtio.a -l:librte_net_vmxnet3.a -l:librte_raw_cnxk_bphy.a -l:librte_raw_cnxk_gpio.a -l:librte_raw_dpaa2_cmdif.a -l:librte_raw_ntb.a -l:librte_raw_skeleton.a -l:librte_crypto_bcmfs.a -l:librte_crypto_caam_jr.a -l:librte_crypto_ccp.a -l:librte_crypto_cnxk.a -l:librte_crypto_dpaa_sec.a -l:librte_crypto_dpaa2_sec.a -l:librte_crypto_ipsec_mb.a -l:librte_crypto_nitrox.a -l:librte_crypto_null.a -l:librte_crypto_octeontx.a -l:librte_crypto_openssl.a -l:librte_crypto_scheduler.a -l:librte_crypto_virtio.a -l:librte_compress_octeontx.a -l:librte_compress_zlib.a -l:librte_regex_cn9k.a -l:librte_ml_cnxk.a -l:librte_vdpa_ifc.a -l:librte_vdpa_sfc.a -l:librte_event_cnxk.a -l:librte_event_dlb2.a -l:librte_event_dpaa.a -l:librte_event_dpaa2.a -l:librte_event_dsw.a -l:librte_event_opdl.a -l:librte_event_skeleton.a -l:librte_event_sw.a -l:librte_event_octeontx.a -l:librte_baseband_acc.a -l:librte_baseband_fpga_5gnr_fec.a -l:librte_baseband_fpga_lte_fec.a -l:librte_baseband_la12xx.a -l:librte_baseband_null.a -l:librte_baseband_turbo_sw.a -l:librte_node.a -l:librte_graph.a -l:librte_pipeline.a -l:librte_table.a -l:librte_pdump.a -l:librte_port.a -l:librte_fib.a -l:librte_ipsec.a -l:librte_vhost.a -l:librte_stack.a -l:librte_security.a -l:librte_sched.a -l:librte_reorder.a -l:librte_rib.a -l:librte_dmadev.a -l:librte_mldev.a -l:librte_regexdev.a -l:librte_rawdev.a -l:librte_power.a -l:librte_pcapng.a -l:librte_member.a -l:librte_lpm.a -l:librte_latencystats.a -l:librte_jobstats.a -l:librte_ip_frag.a -l:librte_gso.a -l:librte_gro.a -l:librte_gpudev.a -l:librte_eventdev.a -l:librte_efd.a -l:librte_distributor.a -l:librte_cryptodev.a -l:librte_compressdev.a -l:librte_cfgfile.a -l:librte_bpf.a -l:librte_bitratestats.a -l:librte_bbdev.a -l:librte_acl.a -l:librte_timer.a -l:librte_hash.a -l:librte_metrics.a -l:librte_cmdline.a -l:librte_pci.a -l:librte_ethdev.a -l:librte_meter.a -l:librte_net.a -l:librte_mbuf.a -l:librte_mempool.a -l:librte_rcu.a -l:librte_ring.a -l:librte_eal.a -l:librte_telemetry.a -l:librte_kvargs.a -Wl,--no-whole-archive -Wl,--export-dynamic -lpcap -lIPSec_MB -latomic -lcrypto -ldl -lz -lelf -lz -Wl,--as-needed -lrte_node -lrte_graph -lrte_pipeline -lrte_table -lrte_pdump -lrte_port -lrte_fib -lrte_ipsec -lrte_vhost -lrte_stack -lrte_security -lrte_sched -lrte_reorder -lrte_rib -lrte_dmadev -lrte_mldev -lrte_regexdev -lrte_rawdev -lrte_power -lrte_pcapng -lrte_member -lrte_lpm -lrte_latencystats -lrte_jobstats -lrte_ip_frag -lrte_gso -lrte_gro -lrte_gpudev -lrte_eventdev -lrte_efd -lrte_distributor -lrte_cryptodev -lrte_compressdev -lrte_cfgfile -lrte_bpf -lrte_bitratestats -lrte_bbdev -lrte_acl -lrte_timer -lrte_hash -lrte_metrics -lrte_cmdline -lrte_pci -lrte_ethdev -lrte_meter -lrte_net -lrte_mbuf -lrte_mempool -lrte_rcu -lrte_ring -lrte_eal -lrte_telemetry -lrte_kvargs -pthread -lm -ldl -lnuma -lpcap

Now when I tried to compile PKTGEN, it worked too but the generated Binary size is about 400K. It gives me reflection that PKTGEN is using shared libs instead of static.

I removed the shared libs from DPDK install folder and rebuild pktgen, it compiled and now the binary size is 1.4M

du -sh Builddir/app/pktgen 1.4M Builddir/app/pktgen

Also executing the same binary gives me error, unable to parse pci. My suspicion was it is not able to get librte_net_bond. As stated in last of meson.

dpdk_bond = cc.find_library('librte_net_bond', dirs: [dpdk_libs_path], required: false)

To confirm I changed the value of required from false to true and now compilation fails as pkgconfig is not able to locate the path, eventhough it's at the same place.

Below are the two steps I did to update path and get the lib.

dpdk_libs_path = dpdk.get_pkgconfig_variable('libdir') dpdk_bond = cc.find_library('librte_net_bond', dirs: [dpdk_libs_path], required: true)

It compiled but again, same size binary 1.4M that too fail to parse PCI.

As a comparison When I tried to build the pktgen 3.7.2 with DPDK 18.11, pktgen binary size is comping out to be 9MB.

Below is the output of pktgen build. "

make clean;make
Use 'make help' for more commands\n
./tools/pktgen-build.sh clean
>>  SDK Path          : /root/latest
>>  Install Path      : /root/latest/pktgen
>>  Build Directory   : /root/latest/pktgen/Builddir
>>  Target Directory  : usr/local
>>  Build Path        : /root/latest/pktgen/Builddir
>>  Target Path       : /root/latest/pktgen/usr/local

 Build and install values:
   lua_enabled       : -Denable_lua=false
   gui_enabled       : -Denable_gui=false

*** Removing '/root/latest/pktgen/Builddir' directory
>>> Use 'make help' for more commands\n
./tools/pktgen-build.sh build
>>  SDK Path          : /root/latest
>>  Install Path      : /root/latest/pktgen
>>  Build Directory   : /root/latest/pktgen/Builddir
>>  Target Directory  : usr/local
>>  Build Path        : /root/latest/pktgen/Builddir
>>  Target Path       : /root/latest/pktgen/usr/local

 Build and install values:
   lua_enabled       : -Denable_lua=false
   gui_enabled       : -Denable_gui=false

>>> 
`Ninja build in '/root/latest/pktgen/Builddir' buildtype=release
meson setup -Dbuildtype=release -Denable_lua=false -Denable_gui=false /root/latest/pktgen/Builddir
The Meson build system
Version: 0.61.5
Source dir: /root/latest/pktgen
Build dir: /root/latest/pktgen/Builddir
Build type: native build
Program cat found: YES (/usr/bin/cat)
Project name: pktgen
Project version: 23.06.1
C compiler for the host machine: /opt/gcc-4.9.3/bin/gcc (gcc 4.9.3 "gcc (GCC) 4.9.3")
C linker for the host machine: /opt/gcc-4.9.3/bin/gcc ld.bfd 2.27-34
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 -std=c99: YES 
meson.build:41: WARNING: Consider using the built-in option for language standard version instead of using "-std=c99".
Compiler for C supports arguments -Wno-pedantic: YES 
Compiler for C supports arguments -Wno-format-truncation: NO 
Found pkg-config: /usr/bin/pkg-config (0.29.2)
Run-time dependency libdpdk found: YES 23.03.0
Message: DPDK lib path: /root/install/lib64
Library librte_net_bond found: YES
Program python3 found: YES (/usr/bin/python3)
app/meson.build:35: WARNING: Project targeting '>= 0.47.1' but tried to use feature introduced in '0.51.0': static arg in compiler.find_library.
Library rte_net_i40e found: YES
app/meson.build:36: WARNING: Project targeting '>= 0.47.1' but tried to use feature introduced in '0.51.0': static arg in compiler.find_library.
Library rte_net_ixgbe found: YES
app/meson.build:37: WARNING: Project targeting '>= 0.47.1' but tried to use feature introduced in '0.51.0': static arg in compiler.find_library.
Library rte_net_ice found: YES
app/meson.build:38: WARNING: Project targeting '>= 0.47.1' but tried to use feature introduced in '0.51.0': static arg in compiler.find_library.
Library rte_bus_vdev found: YES
Run-time dependency threads found: YES
Library numa found: YES
Library pcap found: YES
Library dl found: YES
Library m found: YES
Program doxygen found: YES (/usr/bin/doxygen)
Program generate_doxygen.sh found: YES (/root/latest/pktgen/doc/api/generate_doxygen.sh)
Program generate_examples.sh found: YES (/root/latest/pktgen/doc/api/generate_examples.sh)
Program doxy-html-custom.sh found: YES (/root/latest/pktgen/doc/api/doxy-html-custom.sh)
Configuring doxy-api.conf using configuration
Program sphinx-build found: NO
Build targets in project: 11
WARNING: Project specifies a minimum meson_version '>= 0.47.1' but uses features which were added in newer versions:
 * 0.51.0: {'static arg in compiler.find_library'}
NOTICE: Future-deprecated features used:
 * 0.56.0: {'meson.source_root', 'Dependency.get_pkgconfig_variable', 'meson.build_root'}

pktgen 23.06.1

  User defined options
    buildtype : release
    enable_gui: false
    enable_lua: false

Found ninja-1.11.1.git.kitware.jobserver-1 at /usr/local/bin/ninja
NOTICE: You are using Python 3.6 which is EOL. Starting with v0.62.0, Meson will require Python 3.7 or newer
ninja: Entering directory `/root/latest/pktgen/Builddir'
[69/69] Linking target app/pktgen
>>> Ninja install to '/root/latest/pktgen/usr/local'
ninja: Entering directory `/root/latest/pktgen/Builddir'
[0/1] Installing files.
Installing app/pktgen to /root/latest/pktgen/usr/local/bin
NOTICE: You are using Python 3.6 which is EOL. Starting with v0.62.0, Meson will require Python 3.7 or newer
du -sh Builddir/app/pktgen
1.4M    Builddir/app/pktgen

"

I need staticly linked pktgen binary.

0

There are 0 best solutions below