DPDK patches and discussions
 help / color / mirror / Atom feed
* Link custom libarchive meson support
@ 2025-02-11 18:46 Ben Magistro
  2025-02-19 17:42 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Magistro @ 2025-02-11 18:46 UTC (permalink / raw)
  To: dev

[-- Attachment #1: Type: text/plain, Size: 3201 bytes --]

Will acknowledge this may be more of a meson question and less of a DPDK
issue but things didn't seem to work as expected and had to tweak the
config/meson.build to want to start with the DPDK team.

Our project is cmake based and we use fetch content to pull in our external
dependencies (eg dpdk, libarchive, etc).  We recently noticed
(rediscovered) that DPDK was not linking libarchive which causes the OS
provided DDP for the Intel ICE based cards to be unable to be
decompressed.  Previously we had some additional items installed that
provided an uncompressed DDP file.  As our project already builds
libarchive we did not want to install it at the os level for inclusion into
DPDK as we may now be mixing versions within our application.

In our cmake we added -Dpkg_config_path to help meson find our libarchive
build (it is not installed as it is statically linked into our app).  This
worked but did not expose the include and link directories or any libs that
may also need to be linked from the pc file.  We had to make some changes
to get those added and allow things to compile cleanly.  I can confirm the
changes here work but feel they should not have been necessary.

What is the correct way to link/use a custom libarchive (or any dependency
for that matter) with DPDK?  I've attached the diff for the meson changes
plus the generated pc file for libarchive that we are telling meson to find
with the pkg_config_path parameter.

---

```
diff --git a/config/meson.build b/config/meson.build
index 6d9ffd4f4b..3942b3e1dc 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -207,11 +207,21 @@ endif

 libarchive = dependency('libarchive', required: false, method:
'pkg-config')
 if libarchive.found()
+    link_libs = libarchive.get_pkgconfig_variable('tc_link_libs').split()
+    libarchive_link_libs = []
+    foreach lib : link_libs
+      if lib.startswith('-l')
+        libarchive_link_libs += lib
+      endif
+    endforeach
+
     dpdk_conf.set('RTE_HAS_LIBARCHIVE', 1)
     # Push libarchive link dependency at the project level to support
     # statically linking dpdk apps. Details at:
     # https://inbox.dpdk.org/dev/20210605004024.660267a1@sovereign/
-    add_project_link_arguments('-larchive', language: 'c')
+    add_project_link_arguments('-larchive',
'-L@0@'.format(libarchive.get_pkgconfig_variable('libdir')),
libarchive_link_libs, language: 'c')
+
+    add_project_arguments('-I@0@'.format(libarchive.get_pkgconfig_variable('includedir')),
language: 'c')
     dpdk_extra_ldflags += '-larchive'
 endif
```

----
some paths have been altered to hide user/application info
```
prefix=/opt/vendor/debug-trace
exec_prefix=${prefix}
libdir=/home/user/bitbucket/app/build/lib
includedir=/home/user/bitbucket/app/build/_deps/libarchive-src/libarchive
tc_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:
```

[-- Attachment #2: Type: text/html, Size: 3807 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Link custom libarchive meson support
  2025-02-11 18:46 Link custom libarchive meson support Ben Magistro
@ 2025-02-19 17:42 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2025-02-19 17:42 UTC (permalink / raw)
  To: Ben Magistro; +Cc: dev, bruce.richardson

11/02/2025 19:46, Ben Magistro:
> Will acknowledge this may be more of a meson question and less of a DPDK
> issue but things didn't seem to work as expected and had to tweak the
> config/meson.build to want to start with the DPDK team.
> 
> Our project is cmake based and we use fetch content to pull in our external
> dependencies (eg dpdk, libarchive, etc).  We recently noticed
> (rediscovered) that DPDK was not linking libarchive which causes the OS
> provided DDP for the Intel ICE based cards to be unable to be
> decompressed.  Previously we had some additional items installed that
> provided an uncompressed DDP file.  As our project already builds
> libarchive we did not want to install it at the os level for inclusion into
> DPDK as we may now be mixing versions within our application.
> 
> In our cmake we added -Dpkg_config_path to help meson find our libarchive
> build (it is not installed as it is statically linked into our app).  This
> worked but did not expose the include and link directories or any libs that
> may also need to be linked from the pc file.

I don't understand this part.
It should be sufficient.
Are you saying your .pc file is not correct because not installed?

> We had to make some changes
> to get those added and allow things to compile cleanly.  I can confirm the
> changes here work but feel they should not have been necessary.
> 
> What is the correct way to link/use a custom libarchive (or any dependency
> for that matter) with DPDK?  I've attached the diff for the meson changes
> plus the generated pc file for libarchive that we are telling meson to find
> with the pkg_config_path parameter.

The correct way is to give the path to the .pc file.
Please give more info about what is failing.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-02-19 17:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-11 18:46 Link custom libarchive meson support Ben Magistro
2025-02-19 17:42 ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).