diff mbox series

[meta-lts-mixins,scarthgap/rust,06/11] cargo-c: fix debug symbols containing TMPDIR references

Message ID 7cab7c379a06cfa313d9f7b6282732e95b2bb113.1762633051.git.scott.murray@konsulko.com
State New
Headers show
Series Update to Rust 1.90.0 | expand

Commit Message

Scott Murray Nov. 8, 2025, 8:19 p.m. UTC
From: Yash Shinde <Yash.Shinde@windriver.com>

When building cargo-c with DEBUG mode, QA checks fail due to
absolute paths from the build environment (TMPDIR) being embedded into
the debug symbols/binaries. This causes issues such as:

  ERROR: do_package_qa: File /usr/bin/.debug/cargo-capi contains reference to TMPDIR [buildpaths]
  ERROR: do_package_qa: File /usr/bin/.debug/cargo-cinstall contains reference to TMPDIR [buildpaths]
  ERROR: do_package_qa: File /usr/bin/.debug/cargo-cbuild contains reference to TMPDIR [buildpaths]
  ERROR: do_package_qa: File /usr/bin/.debug/cargo-ctest contains reference to TMPDIR [buildpaths]

To fix this, pass an additional -ffile-prefix-map option to DEBUG_PREFIX_MAP to
ensure that paths under `${CARGO_HOME}` are remapped to `${TARGET_DBGSRC_DIR}`.
This ensures debug info is reproducible and does not leak host-specific paths.

Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(adapted from oe-core commit 3239961e35434592c06ec2cae2885ab464d35744)
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
---
 recipes-devtools/rust/cargo-c_0.10.16+cargo-0.91.0.bb | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/recipes-devtools/rust/cargo-c_0.10.16+cargo-0.91.0.bb b/recipes-devtools/rust/cargo-c_0.10.16+cargo-0.91.0.bb
index fd15f02..5ef68e1 100644
--- a/recipes-devtools/rust/cargo-c_0.10.16+cargo-0.91.0.bb
+++ b/recipes-devtools/rust/cargo-c_0.10.16+cargo-0.91.0.bb
@@ -12,6 +12,8 @@  SRC_URI = "crate://crates.io/cargo-c/${PV};name=cargo-c \
 SRC_URI[cargo-c.sha256sum] = "17d431789b050b0fcf678455dfd5ceb7e5b45cd806140f8fe03b16b995d6cbff"
 S = "${CARGO_VENDORING_DIRECTORY}/cargo-c-${PV}"
 
+DEBUG_PREFIX_MAP += "-ffile-prefix-map=${CARGO_HOME}=${TARGET_DBGSRC_DIR}"
+
 inherit cargo cargo-update-recipe-crates pkgconfig
 
 DEPENDS = "openssl curl"