[PATCH v7 2/7] package_rpm.bbclass: Define _lib and _libdir for rpmbuild

liezhi.yang
2026-03-01T12:26:26Z

From: Robert Yang <liezhi.yang@windriver.com>

The rpmbuild is from rpm-native, the lib and _libdir may be
incorrect for target, for example:

* rpm 4.20.1:
No pkg-config files can be found for qemux86-64 or qemuarm64

* rpm 6.0.1:
- qemux86-64: The _lib is lib64, this is incorrect when multilib is not
enabled, and _libdir is RECIPE_SYSROOT_NATIVE/usr/lib, this
makes the pkg-config files can't be matched.

- qemuarm64/qemux86: The _lib is lib64, this is incorrect, but _libdir is
correct (/usr/lib), so the pkg-config files can be found,
this also looks wild.

The rpmbuild is like cross build, define the values when run it can fix the
problems for rpm 6.0.1.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
meta/classes-global/package_rpm.bbclass | 2 ++
1 file changed, 2 insertions(+)

diff --git a/meta/classes-global/package_rpm.bbclass b/meta/classes-global/package_rpm.bbclass
index bb3b8f830a..f4dd779a52 100644
--- a/meta/classes-global/package_rpm.bbclass
+++ b/meta/classes-global/package_rpm.bbclass
@@ -620,6 +620,8 @@ python do_package_rpm () {
cmd = rpmbuild
cmd = cmd + " --noclean --nodeps --short-circuit --target " + pkgarch + " --buildroot " + pkgd
cmd = cmd + " --define '_topdir " + workdir + "' --define '_rpmdir " + pkgwritedir + "'"
+ cmd = cmd + " --define '_lib ${BASELIB}'"
+ cmd = cmd + " --define '_libdir ${libdir}'"
cmd = cmd + " --define '_builddir " + d.getVar('B') + "'"
cmd = cmd + " --define '_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm'"
cmd = cmd + " --define '_binaries_in_noarch_packages_terminate_build 0'"
--
2.49.1