diff mbox series

[meta-oe,3/5] librice: fix rice-proto.h lookup by not sysroot-rewriting internal .pc

Message ID 20260722184939.495321-3-khem.raj@oss.qualcomm.com
State New
Headers show
Series [meta-networking,1/5] ufw: make usrmerge setup.py sed idempotent | expand

Commit Message

Khem Raj July 22, 2026, 6:49 p.m. UTC
do_compile panicked in rice-c/build.rs:

  thread 'main' panicked at rice-c/build.rs:101:
  Could not find rice-proto.h header

rice-c/build.rs builds the internal rice-proto C library in-tree via
"cargo cinstall --prefix <OUT_DIR>/rice-proto-cbuild" and then locates
it through system-deps + pkg-config. The generated rice-proto.pc carries
an absolute prefix pointing into the in-build OUT_DIR. pkgconfig.bbclass
exports PKG_CONFIG_SYSROOT_DIR=${STAGING_DIR_HOST}, and pkgconf prepends
that sysroot onto the already-absolute prefix, yielding a doubled,
non-existent include path (recipe-sysroot/<abs-build-path>/include/rice).
The header search then fails. The internal lib is never staged in the
sysroot, so sysroot rewriting must not be applied to its .pc.

Clear PKG_CONFIG_SYSROOT_DIR so the internal prefix is used verbatim.
openssl-sys is the only other pkg-config consumer in the crate graph and
would break without the sysroot, so point it at the target openssl
directly via OPENSSL_LIB_DIR/OPENSSL_INCLUDE_DIR (openssl-sys returns
those and skips its pkg-config probe when both are set). Verified a clean
build: rice-proto.h is found and librice-proto/librice-io plus the header
are packaged.

Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
 meta-oe/recipes-support/librice/librice_0.4.3.bb | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff mbox series

Patch

diff --git a/meta-oe/recipes-support/librice/librice_0.4.3.bb b/meta-oe/recipes-support/librice/librice_0.4.3.bb
index b479bc73f4..926244d780 100644
--- a/meta-oe/recipes-support/librice/librice_0.4.3.bb
+++ b/meta-oe/recipes-support/librice/librice_0.4.3.bb
@@ -15,3 +15,19 @@  require ${PN}-crates.inc
 CARGO_BUILD_FLAGS += " --workspace"

 export LIBCLANG_PATH = "${STAGING_LIBDIR_NATIVE}/libclang.so"
+
+# rice-c/build.rs builds the internal rice-proto C library in-tree (via
+# "cargo cinstall") and then locates it through system-deps + pkg-config.
+# The generated rice-proto.pc carries an absolute prefix pointing at the
+# in-build OUT_DIR (.../rice-c-<hash>/out/rice-proto-cbuild). pkgconf prepends
+# PKG_CONFIG_SYSROOT_DIR (=recipe-sysroot) to that already-absolute prefix,
+# producing a doubled, non-existent include path and making build.rs panic
+# with "Could not find rice-proto.h header". The internal lib is not staged in
+# the sysroot, so no sysroot rewriting must be applied to its .pc file.
+# Clear PKG_CONFIG_SYSROOT_DIR for the build so the internal prefix is used
+# verbatim. openssl-sys is the only other pkg-config consumer here, so feed it
+# the sysroot openssl explicitly (this bypasses its pkg-config probe entirely,
+# see openssl-sys find_normal.rs) to keep it pointed at the target sysroot.
+export PKG_CONFIG_SYSROOT_DIR = ""
+export OPENSSL_LIB_DIR = "${STAGING_LIBDIR}"
+export OPENSSL_INCLUDE_DIR = "${STAGING_INCDIR}"