diff mbox series

[meta-lts-mixins,wrynose/rust,03/19] cargo_common: map the cargo vendoring directory for the C compiler

Message ID 509fb1941c0dd7de502ec175de1595cd22adcd51.1794870526.git.scott.murray@konsulko.com
State New
Headers show
Series Update to 1.99.1 | expand

Commit Message

Scott Murray Nov. 16, 2026, 11:12 p.m. UTC
From: Markus Volk <f_l_k@t-online.de>

Crates that ship C or assembly sources, ring being a prominent one,
compile them through the cc crate rather than rustc. RUST_DEBUG_REMAP
only passes --remap-path-prefix to rustc, and DEBUG_PREFIX_MAP covers
S, B and the sysroots, so nothing rewrites the paths below CARGO_HOME.
The build directory of every vendored crate therefore ends up in the
debug symbols, which trips the buildpaths QA check and leaves recipes
working around it by dropping their -dbg package.

Add the vendoring directory to DEBUG_PREFIX_MAP so those objects are
remapped like the rest.

Tested on corei7-64 with yazi and eilmeldung, both of which had dropped
their -dbg package for this reason: after the change they package the
debug symbols with no reference to the build tree left.

AI-Generated: Uses Claude Code (Claude Opus 5)
Signed-off-by: Markus Volk <f_l_k@t-online.de>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
(adapted from oe-core commit fd245ac1c2dfa2de2dad96b7db2a0201bc5c25d4)
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
---
 classes-recipe/cargo_common.bbclass | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/classes-recipe/cargo_common.bbclass b/classes-recipe/cargo_common.bbclass
index f58bd80..1478262 100644
--- a/classes-recipe/cargo_common.bbclass
+++ b/classes-recipe/cargo_common.bbclass
@@ -51,6 +51,11 @@  CARGO_TARGET_SUBDIR = "${RUST_HOST_SYS}/${BUILD_DIR}"
 # Where we download our registry and dependencies to
 export CARGO_HOME = "${UNPACKDIR}/cargo_home"
 
+# Crates that compile C or assembly sources do so through the cc crate, which
+# is not covered by the rustc specific RUST_DEBUG_REMAP, so map the vendoring
+# directory for the C compiler as well.
+DEBUG_PREFIX_MAP += "-ffile-prefix-map=${CARGO_HOME}=${TARGET_DBGSRC_DIR}"
+
 # Don't instruct cargo to use crates downloaded by bitbake. Some rust packages,
 # for example the rust compiler itself, come with their own vendored sources.
 # Specifying two [source.crates-io] will not work.