All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sumanth Gavini <sumanth.gavini@windriver.com>
To: openembedded-core@lists.openembedded.org
Cc: alex.kanavin@gmail.com, mathieu.dubois-briand@bootlin.com,
	mattware@cisco.com, esparlin@cisco.com, peter.marko@siemens.com,
	randy.macleod@windriver.com
Subject: [PATCH v15 08/12] rpm: Fix pkgconfig() Provides missing in cross-built RPMs
Date: Sun, 16 Aug 2026 16:11:00 -0700	[thread overview]
Message-ID: <20260816231104.3871015-9-sumanth.gavini@windriver.com> (raw)
In-Reply-To: <20260816231104.3871015-1-sumanth.gavini@windriver.com>

* Added 0002-pkgconfigdeps.sh-Unset-cross-compilation-PKG_CONFIG-v.patch
  - rpm 6's internal dependency generator runs pkgconfigdeps.sh during
    rpmbuild, but OE's cross-build environment exports PKG_CONFIG_SYSROOT_DIR
    which causes pkg-config --print-provides to silently fail on .pc files
    in the package buildroot.

    Unset cross-compilation PKG_CONFIG_* variables in pkgconfigdeps.sh so
    that pkgconfig() Provides/Requires are correctly generated.

    Without this fix, do_rootfs fails with errors like:
    nothing provides pkgconfig(ogg) needed by flac-dev

Signed-off-by: Sumanth Gavini <sumanth.gavini@windriver.com>
---
 ...Unset-cross-compilation-PKG_CONFIG-v.patch | 71 +++++++++++++++++++
 meta/recipes-devtools/rpm/rpm_6.0.2.bb        |  1 +
 2 files changed, 72 insertions(+)
 create mode 100644 meta/recipes-devtools/rpm/files/0002-pkgconfigdeps.sh-Unset-cross-compilation-PKG_CONFIG-v.patch

diff --git a/meta/recipes-devtools/rpm/files/0002-pkgconfigdeps.sh-Unset-cross-compilation-PKG_CONFIG-v.patch b/meta/recipes-devtools/rpm/files/0002-pkgconfigdeps.sh-Unset-cross-compilation-PKG_CONFIG-v.patch
new file mode 100644
index 0000000000..eccf708872
--- /dev/null
+++ b/meta/recipes-devtools/rpm/files/0002-pkgconfigdeps.sh-Unset-cross-compilation-PKG_CONFIG-v.patch
@@ -0,0 +1,71 @@
+From a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0 Mon Sep 17 00:00:00 2001
+From: Sumanth Gavini <sumanth.gavini@windriver.com>
+Date: Tue, 04 Aug 2026 23:30:00 -0700
+Subject: [PATCH] pkgconfigdeps.sh: Unset cross-compilation PKG_CONFIG variables
+
+In OpenEmbedded/Yocto cross-compilation environments, several
+PKG_CONFIG_* environment variables are set to point pkg-config at the
+target sysroot for recipe builds:
+
+  PKG_CONFIG_SYSROOT_DIR=".../recipe-sysroot"
+  PKG_CONFIG_LIBDIR=".../recipe-sysroot/usr/lib/pkgconfig:..."
+  PKG_CONFIG_SYSTEM_INCLUDE_PATH=".../recipe-sysroot/usr/include"
+  PKG_CONFIG_SYSTEM_LIBRARY_PATH=".../recipe-sysroot/lib:..."
+
+These variables persist into the do_package_write_rpm task environment.
+When rpmbuild's internal dependency generator invokes pkgconfigdeps.sh,
+the script calls pkg-config --print-provides and --print-requires on .pc
+files located in the package buildroot directory (e.g.,
+.../package/usr/lib/pkgconfig/ogg.pc).
+
+With PKG_CONFIG_SYSROOT_DIR set, pkg-config fails silently (exit 1, no
+output) when querying these .pc files because it attempts to validate
+paths with the sysroot prefix prepended, which doesn't match the
+buildroot location. This causes all pkgconfig(...) Provides and Requires
+to be missing from the generated RPMs.
+
+The result is do_rootfs failures like:
+  nothing provides pkgconfig(ogg) needed by flac-dev
+  nothing provides pkgconfig(libxml-2.0) needed by libcomps-dev
+  nothing provides pkgconfig(ncurses) needed by libreadline-dev
+
+Fix this by unsetting the cross-compilation PKG_CONFIG variables at the
+top of pkgconfigdeps.sh. The script already sets PKG_CONFIG_PATH
+explicitly to the directory containing the .pc file being scanned, so
+these external variables are not needed and only cause interference.
+
+This was not an issue with rpm 4.x because OE-core disabled the
+internal dependency generator entirely via:
+  --define '_use_internal_dependency_generator 0'
+  --define '__find_provides %{nil}'
+  --define '__find_requires %{nil}'
+
+rpm 6 no longer supports disabling the internal dependency generator
+for v6 format packages, making pkgconfigdeps.sh active for the first
+time in the OE cross-build environment.
+
+Upstream-Status: Inappropriate [OE specific]
+Signed-off-by: Sumanth Gavini <sumanth.gavini@windriver.com>
+---
+ scripts/pkgconfigdeps.sh | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/scripts/pkgconfigdeps.sh b/scripts/pkgconfigdeps.sh
+index 1cab58169..f9a3b7c21 100755
+--- a/scripts/pkgconfigdeps.sh
++++ b/scripts/pkgconfigdeps.sh
+@@ -1,5 +1,14 @@
+ #!/bin/bash
+ 
++# Clear cross-compilation PKG_CONFIG variables that interfere with querying
++# .pc files directly from the package buildroot. In cross-build environments
++# (e.g., OpenEmbedded/Yocto), these variables point at the target sysroot and
++# cause pkg-config to fail when processing buildroot-relative .pc files.
++unset PKG_CONFIG_SYSROOT_DIR
++unset PKG_CONFIG_LIBDIR
++unset PKG_CONFIG_SYSTEM_INCLUDE_PATH
++unset PKG_CONFIG_SYSTEM_LIBRARY_PATH
++
+ pkgconfig=/usr/bin/pkg-config
+ test -x $pkgconfig || {
+     cat > /dev/null
diff --git a/meta/recipes-devtools/rpm/rpm_6.0.2.bb b/meta/recipes-devtools/rpm/rpm_6.0.2.bb
index e8977aa31a..c0255941ea 100644
--- a/meta/recipes-devtools/rpm/rpm_6.0.2.bb
+++ b/meta/recipes-devtools/rpm/rpm_6.0.2.bb
@@ -39,6 +39,7 @@ SRC_URI = "git://github.com/rpm-software-management/rpm;branch=rpm-6.0.x;protoco
            file://0002-rpmio-rpmglob.c-avoid-using-GLOB_BRACE-if-undefined-.patch \
            file://0001-tools-elfdeps.cc-Remove-format-module.patch \
            file://0001-macros.in-Set-_pkgverify_level-to-digest-as-RCPM-4.2.patch \
+           file://0002-pkgconfigdeps.sh-Unset-cross-compilation-PKG_CONFIG-v.patch \
            "
 
 PE = "1"


  parent reply	other threads:[~2026-08-16 23:11 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-16 23:10 [PATCH v15 00/12] rpm: 4.20.1 -> 6.0.2 Sumanth Gavini
2026-08-16 23:10 ` [PATCH v15 01/12] package_rpm.bbclass: Drop external dependency generator to support rpm 6 Sumanth Gavini
2026-08-17  8:55   ` Mathieu Dubois-Briand
2026-08-17 13:34     ` Gavini, Sumanth
2026-08-17 14:48       ` Mathieu Dubois-Briand
2026-08-17 20:15         ` Alexander Kanavin
2026-08-19  7:10         ` Mathieu Dubois-Briand
2026-08-22  9:05   ` [OE-core] " Richard Purdie
2026-08-16 23:10 ` [PATCH v15 02/12] package_rpm.bbclass: Define _lib and _libdir for rpmbuild Sumanth Gavini
2026-08-16 23:10 ` [PATCH v15 03/12] lib/oe/package.py: Don't add ldconfig_postinst_fragment for glibc or musl Sumanth Gavini
2026-08-16 23:10 ` [PATCH v15 04/12] lib/oe/package.py: Don't redirect stderr Sumanth Gavini
2026-08-16 23:10 ` [PATCH v15 05/12] target-sdk-provides-dummy: Add pkg-config to DUMMYPROVIDES Sumanth Gavini
2026-08-16 23:10 ` [PATCH v15 06/12] rpm: 4.20.1 -> 6.0.2 Sumanth Gavini
2026-08-16 23:10 ` [PATCH v15 07/12] libarchive: Make it work with rpm 6.0.2 Sumanth Gavini
2026-08-16 23:11 ` Sumanth Gavini [this message]
2026-08-16 23:11 ` [PATCH v15 09/12] libarchive: Add RPM format reader to support rpm 6 Sumanth Gavini
2026-08-16 23:11 ` [PATCH v15 10/12] libarchive: Disable RPM filter auto-bidding and update huge_rpm test Sumanth Gavini
2026-08-23  8:06   ` [OE-core] " Richard Purdie
2026-08-16 23:11 ` [PATCH v15 11/12] package_rpm.bbclass: Suppress pkgconfig() Requires for sstate compatibility Sumanth Gavini
2026-08-16 23:11 ` [PATCH v15 12/12] lib/oe/package_manager/rpm: Enable DNF filelists to resolve file deps Sumanth Gavini
2026-08-17 22:20 ` [OE-core] [PATCH v15 00/12] rpm: 4.20.1 -> 6.0.2 Richard Purdie
2026-08-18  1:13   ` Ryan Eatmon
2026-08-18 16:09   ` Gavini, Sumanth
2026-08-18 21:05     ` Richard Purdie
2026-08-21 23:49       ` Gavini, Sumanth
2026-08-24 18:01         ` Richard Purdie

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=20260816231104.3871015-9-sumanth.gavini@windriver.com \
    --to=sumanth.gavini@windriver.com \
    --cc=alex.kanavin@gmail.com \
    --cc=esparlin@cisco.com \
    --cc=mathieu.dubois-briand@bootlin.com \
    --cc=mattware@cisco.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=peter.marko@siemens.com \
    --cc=randy.macleod@windriver.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.