[meta-oe][PATCH 2/4] tbb: Restrict libhwloc runtime dependency to target builds

Khem Raj <[email protected]> Tue, 28 Jul 2026 00:21:09 -0700
Newsgroups org.openembedded.lists.openembedded-devel
Message-ID <[email protected]>
hwloc is only a build dependency for class-target, but libhwloc was an
unconditional RDEPENDS. native.bbclass rewrites runtime dependencies via
native_filter(), which suffixes any unsuffixed dependency, so libhwloc
became libhwloc-native for tbb-native and nativesdk-libhwloc for
nativesdk-tbb. The hwloc recipe sets no BBCLASSEXTEND, so neither variant
exists and nothing can provide them:

  WARNING: Nothing RPROVIDES 'libhwloc-native' (but virtual:native:...tbb_2022.3.0.bb RDEPENDS on or otherwise requires it)
  WARNING: Nothing RPROVIDES 'nativesdk-libhwloc' (but virtual:nativesdk:...tbb_2022.3.0.bb RDEPENDS on or otherwise requires it)

This cascaded to tbb-dev-native/tbb-native via the generic
RDEPENDS:${PN}-staticdev in bitbake.conf, and from there to opencv-native
through opencv's PACKAGECONFIG[tbb].

Gate the runtime dependency on class-target to match the existing DEPENDS
gating. Target builds keep libhwloc unchanged.

Signed-off-by: Khem Raj <[email protected]>
---
 meta-oe/recipes-support/tbb/tbb_2022.3.0.bb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta-oe/recipes-support/tbb/tbb_2022.3.0.bb b/meta-oe/recipes-support/tbb/tbb_2022.3.0.bb
index e09aa5d96a..0dca19535b 100644
--- a/meta-oe/recipes-support/tbb/tbb_2022.3.0.bb
+++ b/meta-oe/recipes-support/tbb/tbb_2022.3.0.bb
@@ -30,7 +30,9 @@ EXTRA_OECMAKE += " \
                     -DTBB_DISABLE_HWLOC_AUTOMATIC_SEARCH=OFF \
                 "

-RDEPENDS:${PN} += "libhwloc"
+# hwloc is only a build dependency for target builds, so libhwloc can only be
+# a runtime dependency there too (hwloc has no native/nativesdk variants).
+RDEPENDS:${PN}:append:class-target = " libhwloc"
 RDEPENDS:${PN}-ptest += "cmake libhwloc"

 # Hard-float 'd' ABI can't be used for a target that doesn't support the D instruction set extension (ignoring target-abi)