Sorry for the delay in getting back to this and appreciate the assistance. I do not have this in simple setup right now to reproduce but imagine cloning libarchive into say /tmp and setting the appropriate prefixes would get you to a minimum needed to reproduce. I've substituted out the company and application names but those should not be a factor here as the paths are good.
The .pc file is correct but the include paths are not being included in the DPDK make commands
We patch the .pc file from libarchive so that we don't need to track some cmake variables before/after processing libarchive. The final file looks like this. The link_libs variable was added by us as the link libraries need to be passed to dpdk as well. We build libarchive as a statically linked library and only produce a .a file which is present at the path listed here.
```
prefix=/opt/companyname/debug-trace
exec_prefix=${prefix}
libdir=/home/bmagistro/bitbucket/application/build/lib
includedir=/home/bmagistro/bitbucket/application/build/_deps/libarchive-src/libarchive
link_libs=" -lz -lbz2 -llzma -llzo2 -llz4 -lnettle -lcrypto -lxml2 -lxml2 -lz -llzma -lm"
Name: libarchive
Description: library that can create and read several streaming archive formats
Version: 3.7.2
Cflags: -I${includedir}
Cflags.private: -DLIBARCHIVE_STATIC
Libs: -L${libdir} -larchive
Libs.private: -lz -lbz2 -llzma -llzo2 -llz4 -lnettle -lcrypto -lxml2 -lxml2 -lz -llzma -lm
Requires.private:
```
In cmake, we make the following call for dpdk to do its build as an external project (fetchcontent) command.
```
meson --prefix="${DPDK_BUILD_FOLDER}" "${DPDK_MESON_REBUILD}" -Dibverbs_link="none" -Ddisable_libs="${DPDK_DISABLED_LIBS_CSV}" -Ddisable_drivers="${DPDK_DISABLED_DRIVERS_CSV}" -Dtests=false -Dcpu_instruction_set="${PROCESSOR_ARCHITECTURE}" -Dpkg_config_path="${PROJECT_SOURCE_DIR}/build/_deps/libarchive-build/build/pkgconfig/" build && cd build && ninja install
```
That expands to
```
Execute meson;--prefix="/home/bmagistro/bitbucket/application/build/_deps/dpdk-src/build";;-Dibverbs_link="none";-Ddisable_libs="bitratestats,cfgfile,flow_classify,gpudev,jobstats,kni,latencystats,metrics,node,pipeline,port,power,table,vhost";-Ddisable_drivers="common/cnxk,common/cpt,common/dpaax,common/mvep,common/mlx5,common/octeontx,common/octeontx2,common/sfc_efx,common/qat,bus/auxiliary,bus/dpaa,bus/fslmc,bus/ifpga,bus/vmbus,mempool/bucket,mempool/cnxk,mempool/dpaa,mempool/dpaa2,mempool/octeontx,mempool/octeontx2,mempool/stack,dma/cnxk,dma/dpaa,dma/dpaa2,dma/hisilicon,dma/idxd,dma/ioat,dma/skeleton,net/af_xdp,net/ark,net/atlantic,net/avp,net/axgbe,net/bonding,net/bnx2x,net/bnxt,net/cnxk,net/cxgbe,net/dpaa,net/dpaa2,net/e1000,net/ena,net/enetc,net/enetfec,net/enic,net/failsafe,net/fm10k,net/gve,net/hinic,net/hns3,net/idpf,net/igc,net/ionic,net/ipn3ke,net/ixgbe,net/kni,net/liquidio,net/mana,net/memif,net/mlx4,net/mlx5,net/mvneta,net/mvpp2,net/netvsc,net/ngbe,net/nfb,net/nfp,net/null,net/octeon_ep,net/octeontx,net/octeontx2,net/octeontx_ep,net/pfe,net/qede,net/ring,net/sfc,net/softnic,net/szedata2,net/tap,net/thunderx,net/txgbe,net/vdev_netvsc,net/vhost,raw/cnxk_bphy,raw/cnxk_gpio,raw/dpaa2_cmdif,raw/dpaa2_qdma,raw/ifpga,raw/ioat,raw/ntb,raw/octeontx2_dma,raw/octeontx2_ep,raw/skeleton,crypto/aesni_gcm,crypto/aesni_mb,crypto/armv8,crypto/bcmfs,crypto/caam_jr,crypto/ccp,crypto/cnxk,crypto/dpaa_sec,crypto/dpaa2_sec,crypto/ipsec_mb,crypto/kasumi,crypto/mlx5,crypto/mvsam,crypto/nitrox,crypto/null,crypto/octeontx,crypto/octeontx2,crypto/openssl,crypto/qat,crypto/scheduler,crypto/snow3g,crypto/uadk,crypto/virtio,crypto/zuc,compress/octeontx,compress/isal,compress/mlx5,compress/zlib,compress/qat,regex/cn9k,regex/mlx5,regex/octeontx2,vdpa/ifc,vdpa/mlx5,vdpa/sfc,event/cnxk,event/dlb2,event/dpaa,event/dpaa2,event/dsw,event/octeontx,event/octeontx2,event/opdl,event/skeleton,event/sw,baseband/acc,baseband/acc100,baseband/fpga_5gnr_fec,baseband/fpga_lte_fec,baseband/la12xx,baseband/null,baseband/turbo_sw,gpu/cuda";-Dtests=false;-Dcpu_instruction_set="skylake";-Dpkg_config_path="/home/bmagistro/bitbucket/application/build/_deps/libarchive-build/build/pkgconfig/";build;&&;cd;build;&&;ninja;install
```
And when it tries to build dpdk we get the following (i've trimmed the output a bit to keep it readable):
```
make -j12 dpdk
Scanning dependencies of target archive_static
...
[100%] Linking C static library ../../../lib/libarchive.a
[100%] Built target archive_static
Scanning dependencies of target libarchive
[100%] Built target libarchive
Scanning dependencies of target dpdk
[100%] Building dpdk in /home/bmagistro/bitbucket/application/build/_deps/dpdk-src...
Execute meson;--prefix="/home/bmagistro/bitbucket/application/build/_deps/dpdk-src/build";;-Dibverbs_link="none";-Ddisable_libs="bitratestats,cfgfile,flow_classify,gpudev,jobstats,kni,latencystats,metrics,node,pipeline,port,power,table,vhost";-Ddisable_drivers="common/cnxk,common/cpt,common/dpaax,common/mvep,common/mlx5,common/octeontx,common/octeontx2,common/sfc_efx,common/qat,bus/auxiliary,bus/dpaa,bus/fslmc,bus/ifpga,bus/vmbus,mempool/bucket,mempool/cnxk,mempool/dpaa,mempool/dpaa2,mempool/octeontx,mempool/octeontx2,mempool/stack,dma/cnxk,dma/dpaa,dma/dpaa2,dma/hisilicon,dma/idxd,dma/ioat,dma/skeleton,net/af_xdp,net/ark,net/atlantic,net/avp,net/axgbe,net/bonding,net/bnx2x,net/bnxt,net/cnxk,net/cxgbe,net/dpaa,net/dpaa2,net/e1000,net/ena,net/enetc,net/enetfec,net/enic,net/failsafe,net/fm10k,net/gve,net/hinic,net/hns3,net/idpf,net/igc,net/ionic,net/ipn3ke,net/ixgbe,net/kni,net/liquidio,net/mana,net/memif,net/mlx4,net/mlx5,net/mvneta,net/mvpp2,net/netvsc,net/ngbe,net/nfb,net/nfp,net/null,net/octeon_ep,net/octeontx,net/octeontx2,net/octeontx_ep,net/pfe,net/qede,net/ring,net/sfc,net/softnic,net/szedata2,net/tap,net/thunderx,net/txgbe,net/vdev_netvsc,net/vhost,raw/cnxk_bphy,raw/cnxk_gpio,raw/dpaa2_cmdif,raw/dpaa2_qdma,raw/ifpga,raw/ioat,raw/ntb,raw/octeontx2_dma,raw/octeontx2_ep,raw/skeleton,crypto/aesni_gcm,crypto/aesni_mb,crypto/armv8,crypto/bcmfs,crypto/caam_jr,crypto/ccp,crypto/cnxk,crypto/dpaa_sec,crypto/dpaa2_sec,crypto/ipsec_mb,crypto/kasumi,crypto/mlx5,crypto/mvsam,crypto/nitrox,crypto/null,crypto/octeontx,crypto/octeontx2,crypto/openssl,crypto/qat,crypto/scheduler,crypto/snow3g,crypto/uadk,crypto/virtio,crypto/zuc,compress/octeontx,compress/isal,compress/mlx5,compress/zlib,compress/qat,regex/cn9k,regex/mlx5,regex/octeontx2,vdpa/ifc,vdpa/mlx5,vdpa/sfc,event/cnxk,event/dlb2,event/dpaa,event/dpaa2,event/dsw,event/octeontx,event/octeontx2,event/opdl,event/skeleton,event/sw,baseband/acc,baseband/acc100,baseband/fpga_5gnr_fec,baseband/fpga_lte_fec,baseband/la12xx,baseband/null,baseband/turbo_sw,gpu/cuda";-Dtests=false;-Dcpu_instruction_set="skylake";-Dpkg_config_path="/home/bmagistro/bitbucket/application/build/_deps/libarchive-build/build/pkgconfig/";build;&&;cd;build;&&;ninja;install
The Meson build system
Version: 0.63.3
Source dir: /home/bmagistro/bitbucket/application/build/_deps/dpdk-src
Build dir: /home/bmagistro/bitbucket/application/build/_deps/dpdk-src/build
Build type: native build
Program cat found: YES (/usr/bin/cat)
Project name: DPDK
Project version: 23.03.0-rc0
C compiler for the host machine: ccache cc (gcc 11.4.1 "cc (GCC) 11.4.1 20231218 (Red Hat 11.4.1-3)")
C linker for the host machine: cc ld.bfd 2.35.2-43
Host machine cpu family: x86_64
Host machine cpu: x86_64
...
Found pkg-config: /usr/bin/pkg-config (1.7.3)
Run-time dependency libarchive found: YES 3.7.2
...
Build targets in project: 308
DPDK 23.03.0-rc0
User defined options
pkg_config_path : /home/bmagistro/bitbucket/application/build/_deps/libarchive-build/build/pkgconfig/
prefix : /home/bmagistro/bitbucket/application/build/_deps/dpdk-src/build
cpu_instruction_set: skylake
disable_drivers : common/cnxk,common/cpt,common/dpaax,common/mvep,common/mlx5,common/octeontx,common/octeontx2,common/sfc_efx,common/qat,bus/auxiliary,bus/dpaa,bus/fslmc,bus/ifpga,bus/vmbus,mempool/bucket,mempool/cnxk,mempool/dpaa,mempool/dpaa2,mempool/octeontx,mempool/octeontx2,mempool/stack,dma/cnxk,dma/dpaa,dma/dpaa2,dma/hisilicon,dma/idxd,dma/ioat,dma/skeleton,net/af_xdp,net/ark,net/atlantic,net/avp,net/axgbe,net/bonding,net/bnx2x,net/bnxt,net/cnxk,net/cxgbe,net/dpaa,net/dpaa2,net/e1000,net/ena,net/enetc,net/enetfec,net/enic,net/failsafe,net/fm10k,net/gve,net/hinic,net/hns3,net/idpf,net/igc,net/ionic,net/ipn3ke,net/ixgbe,net/kni,net/liquidio,net/mana,net/memif,net/mlx4,net/mlx5,net/mvneta,net/mvpp2,net/netvsc,net/ngbe,net/nfb,net/nfp,net/null,net/octeon_ep,net/octeontx,net/octeontx2,net/octeontx_ep,net/pfe,net/qede,net/ring,net/sfc,net/softnic,net/szedata2,net/tap,net/thunderx,net/txgbe,net/vdev_netvsc,net/vhost,raw/cnxk_bphy,raw/cnxk_gpio,raw/dpaa2_cmdif,raw/dpaa2_qdma,raw/ifpga,raw/ioat,raw/ntb,raw/octeontx2_dma,raw/octeontx2_ep,raw/skeleton,crypto/aesni_gcm,crypto/aesni_mb,crypto/armv8,crypto/bcmfs,crypto/caam_jr,crypto/ccp,crypto/cnxk,crypto/dpaa_sec,crypto/dpaa2_sec,crypto/ipsec_mb,crypto/kasumi,crypto/mlx5,crypto/mvsam,crypto/nitrox,crypto/null,crypto/octeontx,crypto/octeontx2,crypto/openssl,crypto/qat,crypto/scheduler,crypto/snow3g,crypto/uadk,crypto/virtio,crypto/zuc,compress/octeontx,compress/isal,compress/mlx5,compress/zlib,compress/qat,regex/cn9k,regex/mlx5,regex/octeontx2,vdpa/ifc,vdpa/mlx5,vdpa/sfc,event/cnxk,event/dlb2,event/dpaa,event/dpaa2,event/dsw,event/octeontx,event/octeontx2,event/opdl,event/skeleton,event/sw,baseband/acc,baseband/acc100,baseband/fpga_5gnr_fec,baseband/fpga_lte_fec,baseband/la12xx,baseband/null,baseband/turbo_sw,gpu/cuda
disable_libs : bitratestats,cfgfile,flow_classify,gpudev,jobstats,kni,latencystats,metrics,node,pipeline,port,power,table,vhost
ibverbs_link : none
tests : false
Found ninja-1.10.2 at /usr/bin/ninja
[85/746] Compiling C object lib/librte_eal.a.p/eal_unix_eal_firmware.c.o
FAILED: lib/librte_eal.a.p/eal_unix_eal_firmware.c.o
ccache cc -Ilib/librte_eal.a.p -Ilib -I../lib -I. -I.. -Iconfig -I../config -Ilib/eal/include -I../lib/eal/include -Ilib/eal/linux/include -I../lib/eal/linux/include -Ilib/eal/x86/include -I../lib/eal/x86/include -Ilib/eal/common -I../lib/eal/common -Ilib/eal -I../lib/eal -Ilib/kvargs -I../lib/kvargs -I../lib/metrics -Ilib/telemetry -I../lib/telemetry -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -O3 -include rte_config.h -Wcast-qual -Wdeprecated -Wformat -Wformat-nonliteral -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings -Wno-address-of-packed-member -Wno-packed-not-aligned -Wno-missing-field-initializers -Wno-zero-length-bounds -D_GNU_SOURCE -fPIC -march=skylake -DALLOW_EXPERIMENTAL_API -DALLOW_INTERNAL_API -Wno-format-truncation '-DABI_VERSION="23.1"' -DRTE_LIBEAL_USE_GETENTROPY -DRTE_LOG_DEFAULT_LOGTYPE=lib.eal -MD -MQ lib/librte_eal.a.p/eal_unix_eal_firmware.c.o -MF lib/librte_eal.a.p/eal_unix_eal_firmware.c.o.d -o lib/librte_eal.a.p/eal_unix_eal_firmware.c.o -c ../lib/eal/unix/eal_firmware.c
../lib/eal/unix/eal_firmware.c:6:10: fatal error: archive.h: No such file or directory
6 | #include <archive.h>
| ^~~~~~~~~~~
compilation terminated.
[106/746] Generating lib/telemetry.sym_chk with a custom command (wrapped by meson to capture output)
ninja: build stopped: subcommand failed.
make[3]: *** [external/dpdk/CMakeFiles/dpdk.dir/build.make:82: _deps/dpdk-src/build/lib/libdpdk.a] Error 1
make[2]: *** [CMakeFiles/Makefile2:4580: external/dpdk/CMakeFiles/dpdk.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:4587: external/dpdk/CMakeFiles/dpdk.dir/rule] Error 2
make: *** [Makefile:1168: dpdk] Error 2
```
Linking errors
```
[16/89] Linking target app/dpdk-dumpcap
FAILED: app/dpdk-dumpcap
cc -o app/dpdk-dumpcap app/dpdk-dumpcap.p/dumpcap_main.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -Wl,--whole-archive -Wl,--start-group lib/librte_graph.a lib/librte_pdump.a lib/librte_fib.a lib/librte_ipsec.a lib/librte_stack.a lib/librte_security.a lib/librte_sched.a lib/librte_reorder.a lib/librte_rib.a lib/librte_dmadev.a lib/librte_regexdev.a lib/librte_rawdev.a lib/librte_pcapng.a lib/librte_member.a lib/librte_lpm.a lib/librte_ip_frag.a lib/librte_gso.a lib/librte_gro.a lib/librte_eventdev.a lib/librte_efd.a lib/librte_distributor.a lib/librte_cryptodev.a lib/librte_compressdev.a lib/librte_bpf.a lib/librte_bbdev.a lib/librte_acl.a lib/librte_timer.a lib/librte_hash.a lib/librte_cmdline.a lib/librte_pci.a lib/librte_ethdev.a lib/librte_meter.a lib/librte_net.a lib/librte_mbuf.a lib/librte_mempool.a lib/librte_rcu.a lib/librte_ring.a lib/librte_eal.a lib/librte_telemetry.a lib/librte_kvargs.a drivers/librte_common_iavf.a drivers/librte_common_idpf.a drivers/librte_bus_pci.a drivers/librte_bus_vdev.a drivers/librte_mempool_ring.a drivers/librte_net_af_packet.a drivers/librte_net_i40e.a drivers/librte_net_iavf.a drivers/librte_net_ice.a drivers/librte_net_pcap.a drivers/librte_net_virtio.a drivers/librte_net_vmxnet3.a -Wl,--no-whole-archive -Wl,--no-as-needed -pthread -lm -ldl -lnuma -Wl,-rpath,XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -Wl,--export-dynamic /usr/lib64/libpcap.so -Wl,--end-group
/usr/bin/ld: lib/librte_eal.a(eal_unix_eal_firmware.c.o): in function `firmware_read':
eal_firmware.c:(.text+0x22): undefined reference to `archive_read_new'
/usr/bin/ld: eal_firmware.c:(.text+0x36): undefined reference to `archive_read_support_format_raw'
/usr/bin/ld: eal_firmware.c:(.text+0x46): undefined reference to `archive_read_support_filter_xz'
/usr/bin/ld: eal_firmware.c:(.text+0x5e): undefined reference to `archive_read_open_filename'
/usr/bin/ld: eal_firmware.c:(.text+0x73): undefined reference to `archive_read_next_header'
/usr/bin/ld: eal_firmware.c:(.text+0xb5): undefined reference to `archive_read_data'
/usr/bin/ld: eal_firmware.c:(.text+0xe2): undefined reference to `archive_read_free'
/usr/bin/ld: eal_firmware.c:(.text+0xf8): undefined reference to `archive_read_free'
collect2: error: ld returned 1 exit status
[11/89] Linking target app/dpdk-pdump
FAILED: app/dpdk-pdump
cc -o app/dpdk-pdump app/dpdk-pdump.p/pdump_main.c.o -L/home/bmagistro/bitbucket/application/build/lib -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -Wl,--whole-archive -Wl,--start-group lib/librte_graph.a lib/librte_pdump.a lib/librte_fib.a lib/librte_ipsec.a lib/librte_stack.a lib/librte_security.a lib/librte_sched.a lib/librte_reorder.a lib/librte_rib.a lib/librte_dmadev.a lib/librte_regexdev.a lib/librte_rawdev.a lib/librte_pcapng.a lib/librte_member.a lib/librte_lpm.a lib/librte_ip_frag.a lib/librte_gso.a lib/librte_gro.a lib/librte_eventdev.a lib/librte_efd.a lib/librte_distributor.a lib/librte_cryptodev.a lib/librte_compressdev.a lib/librte_bpf.a lib/librte_bbdev.a lib/librte_acl.a lib/librte_timer.a lib/librte_hash.a lib/librte_cmdline.a lib/librte_pci.a lib/librte_ethdev.a lib/librte_meter.a lib/librte_net.a lib/librte_mbuf.a lib/librte_mempool.a lib/librte_rcu.a lib/librte_ring.a lib/librte_eal.a lib/librte_telemetry.a lib/librte_kvargs.a drivers/librte_common_iavf.a drivers/librte_common_idpf.a drivers/librte_bus_pci.a drivers/librte_bus_vdev.a drivers/librte_mempool_ring.a drivers/librte_net_af_packet.a drivers/librte_net_i40e.a drivers/librte_net_iavf.a drivers/librte_net_ice.a drivers/librte_net_pcap.a drivers/librte_net_virtio.a drivers/librte_net_vmxnet3.a -Wl,--no-whole-archive -Wl,--no-as-needed -pthread -lm -ldl -lnuma -larchive -Wl,-rpath,XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -Wl,--export-dynamic /usr/lib64/libpcap.so -Wl,--end-group
/usr/bin/ld: /home/bmagistro/bitbucket/application/build/lib/libarchive.a(archive_read_support_filter_xz.c.o): in function `xz_lzma_bidder_init':
/home/bmagistro/bitbucket/application/build/_deps/libarchive-src/libarchive/archive_read_support_filter_xz.c:515: undefined reference to `lzma_stream_decoder'
/usr/bin/ld: /home/bmagistro/bitbucket/application/build/_deps/libarchive-src/libarchive/archive_read_support_filter_xz.c:519: undefined reference to `lzma_alone_decoder'
/usr/bin/ld: /home/bmagistro/bitbucket/application/build/lib/libarchive.a(archive_read_support_filter_xz.c.o): in function `lzip_init':
/home/bmagistro/bitbucket/application/build/_deps/libarchive-src/libarchive/archive_read_support_filter_xz.c:576: undefined reference to `lzma_properties_decode'
/usr/bin/ld: /home/bmagistro/bitbucket/application/build/_deps/libarchive-src/libarchive/archive_read_support_filter_xz.c:581: undefined reference to `lzma_raw_decoder'
/usr/bin/ld: /home/bmagistro/bitbucket/application/build/lib/libarchive.a(archive_read_support_filter_xz.c.o): in function `xz_filter_read':
/home/bmagistro/bitbucket/application/build/_deps/libarchive-src/libarchive/archive_read_support_filter_xz.c:689: undefined reference to `lzma_code'
/usr/bin/ld: /home/bmagistro/bitbucket/application/build/_deps/libarchive-src/libarchive/archive_read_support_filter_xz.c:715: undefined reference to `lzma_crc32'
/usr/bin/ld: /home/bmagistro/bitbucket/application/build/lib/libarchive.a(archive_read_support_filter_xz.c.o): in function `xz_filter_close':
/home/bmagistro/bitbucket/application/build/_deps/libarchive-src/libarchive/archive_read_support_filter_xz.c:736: undefined reference to `lzma_end'
collect2: error: ld returned 1 exit status
```
In looking at the errors, the include and libe paths from the .pc file are not included in the command being run the so the include fails. When the include path is resolved by adding the include dirs (we do this by patching config/meson.build and adding them in if libarchive is found, same for libs) we then get a linking error starting with a cannot find archive. This occurs because the link libraries path from the .pc file are not being added. When that is resolved we get to the final link error that comes from the additional libraries libarchive is linked against not being passed to dpdk. In pulling this together the link errors may be limited to the apps in dpdk. Several were listed but picked one I know we build/want for troubleshooting purposes. I hope this helps clarify things and am happy to try/provide additional info.