DPDK patches and discussions
 help / color / mirror / Atom feed
From: Srikanth Yalavarthi <syalavarthi@marvell.com>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: Aaron Conole <aconole@redhat.com>,
	Igor Russkikh <irusskikh@marvell.com>,
	 David Marchand <david.marchand@redhat.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	Shivah Shankar Shankar Narayan Rao <sshankarnara@marvell.com>,
	Jerin Jacob Kollanukkaran <jerinj@marvell.com>,
	"stable@dpdk.org" <stable@dpdk.org>,
	Srikanth Yalavarthi <syalavarthi@marvell.com>
Subject: RE: [EXT] Re: [PATCH 1/1] build: update link args and includes for libarchive
Date: Mon, 23 Oct 2023 11:40:14 +0000	[thread overview]
Message-ID: <DS0PR18MB55027639C07E6A4398F53429AED8A@DS0PR18MB5502.namprd18.prod.outlook.com> (raw)
In-Reply-To: <ZTY8KyXEWyOfURmk@bricha3-MOBL.ger.corp.intel.com>

> -----Original Message-----
> From: Bruce Richardson <bruce.richardson@intel.com>
> Sent: 23 October 2023 14:56
> To: Srikanth Yalavarthi <syalavarthi@marvell.com>
> Cc: Aaron Conole <aconole@redhat.com>; Igor Russkikh
> <irusskikh@marvell.com>; David Marchand <david.marchand@redhat.com>;
> dev@dpdk.org; Shivah Shankar Shankar Narayan Rao
> <sshankarnara@marvell.com>; Jerin Jacob Kollanukkaran
> <jerinj@marvell.com>; stable@dpdk.org
> Subject: [EXT] Re: [PATCH 1/1] build: update link args and includes for
> libarchive
> 
> External Email
> 
> ----------------------------------------------------------------------
> On Fri, Oct 20, 2023 at 10:01:35AM -0700, Srikanth Yalavarthi wrote:
> > In order to avoid linking with all libraries listed as Libs.private in
> > libarchive.pc, libarchive is not added to ext_deps during meson setup.
> >
> > Since libarchive is not added to ext_deps, cross-compilation or native
> > compilation with libarchive installed in non-standard location fails
> > with errors related to "cannot find -larchive"
> > or "archive.h: No such file or directory". In order to fix the build
> > failures, user is required to define the 'c_args' and 'c_link_args'
> > with '-I<includedir>' and '-L<libdir>'.
> >
> > This patch updates meson build files to add libarchive's includedir
> > and libdir to compiler flags and would not require setting c_args and
> > c_link_args externally.
> >
> > Fixes: 40edb9c0d36b ("eal: handle compressed firmware")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>
> > ---
> 
> Checking back through the mail archives I'm still a little unclear as to what
> breaks when we try using libarchive as any other package with a pkg-config
> file? I would have thought the best solution was just to add libarchive as an
> external dependency, found using pkg-config, to EAL. When we add it as a
> dependency, rather than using c/ldflags, we should get all this path fixup for
> free?
> Can you clarify what breaks when we add libarchive as a libeal dependency
> only?

Below is my observation.

In current implementation, we are looking for libarchive's availability through pkg-config.
When found, we are setting RTE_HAS_LIBARCHIVE=1 and adding '-larchive' to ldflags.

Since, we are not adding libarchive to ext_deps (to avoid linking with deps.private), the
variables provided by pkg-config like 'includedir' and 'libdir' are ignored by meson and
are not used as part of c_args (-I<includedir>) and c_link_args (-L<libdir>).

In this case, build would fail during cross-compilation and native  compilation (when
libarchive is not installed through package managers like yum/apt). And, we need to
manually set c_args and c_link_args as per the build environment to fix the failures.

This patch fixes the issue observed and avoids the requirement to set c_args and c_link_args
manually . Below are the steps to reproduce the issue (cross-compile for aarch64). Tested on
ubuntu:20.04 docker. Same can be reproduced for native build, if libarchive is not installed
through apt-get.


rm -rf /dpdk-buildtest && mkdir -p /dpdk-buildtest

# libarchive
cd /dpdk-buildtest
wget -N https://www.libarchive.org/downloads/libarchive-3.6.1.tar.gz
tar -xzf libarchive-3.6.1.tar.gz
cd libarchive-3.6.1
./configure --prefix /dpdk-buildtest/install-aarch64 --host=aarch64-linux-gnu --without-xml2 --without-lzma --without-zlib
make
make install

# dpdk
cd /dpdk-buildtest
git clone https://dpdk.org/git/dpdk
cd dpdk
git checkout main
export PKG_CONFIG_PATH=/dpdk-buildtest/install-aarch64/lib/pkgconfig
meson setup --prefix /dpdk-buildtest/install-aarch64 --cross-file config/arm/arm64_armv8_linux_gcc build
ninja -C build

### meson log ### libarchive is found by pkg-config
Has header "execinfo.h" : YES
Found pkg-config: /usr/bin/aarch64-linux-gnu-pkg-config (0.29.1)
Run-time dependency libarchive found: YES 3.6.1
Run-time dependency libbsd found: NO (tried pkgconfig)
Run-time dependency jansson found: NO (tried pkgconfig)


### compilation log ### -I<inlcudedir> is not used
[39/2835] Compiling C object 'lib/76b5a35@@rte_eal@sta/eal_unix_eal_firmware.c.o'.
FAILED: lib/76b5a35@@rte_eal@sta/eal_unix_eal_firmware.c.o
aarch64-linux-gnu-gcc -Ilib/76b5a35@@rte_eal@sta -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/arm/include -I../lib/eal/arm/include -Ilib/eal/common -I../lib/eal/common -Ilib/eal -I../lib/eal -Ilib/kvargs -I../lib/kvargs -Ilib/log -I../lib/log -Ilib/telemetry/../metrics -I../lib/telemetry/../metrics -Ilib/telemetry -I../lib/telemetry -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c11 -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 -D_GNU_SOURCE -fPIC -march=armv8-a+crc -moutline-atomics -DALLOW_EXPERIMENTAL_API -DALLOW_INTERNAL_API -Wno-format-truncation '-DABI_VERSION="24.0"' -DRTE_LOG_DEFAULT_LOGTYPE=lib.eal -MD -MQ 'lib/76b5a35@@rte_eal@sta/eal_unix_eal_firmware.c.o' -MF 'lib/76b5a35@@rte_eal@sta/eal_unix_eal_firmware.c.o.d' -o 'lib/76b5a35@@rte_eal@sta/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.

> 
> /Bruce

  reply	other threads:[~2023-10-23 11:40 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-20 17:01 Srikanth Yalavarthi
2023-10-23  9:26 ` Bruce Richardson
2023-10-23 11:40   ` Srikanth Yalavarthi [this message]
2023-10-23 11:53     ` [EXT] " Bruce Richardson
2023-10-23 12:46       ` Srikanth Yalavarthi
2023-10-23 13:00         ` Bruce Richardson
2023-10-23 13:06           ` Bruce Richardson
2023-10-23 14:01             ` Srikanth Yalavarthi
2023-10-26 12:53               ` Srikanth Yalavarthi
2023-10-29  8:10 ` [PATCH v2 1/1] build: add libarchive to external deps Srikanth Yalavarthi
2023-10-29  8:20 ` [PATCH v3 " Srikanth Yalavarthi
2023-11-03 16:38 ` [PATCH v4 " Srikanth Yalavarthi
2023-11-03 16:50   ` Bruce Richardson
2023-11-06  4:27     ` [EXT] " Srikanth Yalavarthi
2023-11-06  4:12 ` [PATCH v5 " Srikanth Yalavarthi
2023-11-06  8:53   ` Bruce Richardson
2023-11-06 15:24     ` Thomas Monjalon
2023-11-06 15:32       ` Thomas Monjalon
2023-11-06 16:03   ` David Marchand
2023-11-06 16:23     ` Bruce Richardson
2023-11-06 18:17       ` David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DS0PR18MB55027639C07E6A4398F53429AED8A@DS0PR18MB5502.namprd18.prod.outlook.com \
    --to=syalavarthi@marvell.com \
    --cc=aconole@redhat.com \
    --cc=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=irusskikh@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=sshankarnara@marvell.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).