diff mbox series

[meta-lts-mixins,kirkstone/rust] rust: Switch Cargo build to release mode to avoid DEBUG-mode stack overflow

Message ID 20250710143825.3854693-1-Yash.Shinde@windriver.com
State New
Headers show
Series [meta-lts-mixins,kirkstone/rust] rust: Switch Cargo build to release mode to avoid DEBUG-mode stack overflow | expand

Commit Message

Yash Shinde July 10, 2025, 2:38 p.m. UTC
From: Yash Shinde <Yash.Shinde@windriver.com>

DEBUG builds of Cargo (v1.85.1) result in a stack overflow during
compilation of the `p384` crate, causing a segmentation fault:

TOPDIR/tmp-glibc/work/cortexa15t2hf-neon-wrs-linux-gnueabi/cargo/1.85.1-r0/recipe-sysroot-native/usr/bin/../lib/librustc_driver-9603b88fd542d97b.so(+0x1f43519) [0x7f9749cf6519]

note: rustc unexpectedly overflowed its stack! this is a bug
note: maximum backtrace depth reached, frames may have been lost
note: we would appreciate a report at https://github.com/rust-lang/rust
    Building [=================>       ] 255/351: maybe-async, curl-sys(bui...
error: could not compile `p384` (lib)

This issue is resolved in Rust v1.86.0. As a temporary workaround,
this commit forces Cargo to be built in release mode to avoid the
bug until the toolchain is updated.

Fix in Rust v1.86.0:
https://github.com/RustCrypto/elliptic-curves/commit/7652c5842cde60acc1e739ebbba34614cb158f8b

Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
---
 recipes-devtools/rust/cargo_1.85.1.bb | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/recipes-devtools/rust/cargo_1.85.1.bb b/recipes-devtools/rust/cargo_1.85.1.bb
index a6d3f17..f88f960 100644
--- a/recipes-devtools/rust/cargo_1.85.1.bb
+++ b/recipes-devtools/rust/cargo_1.85.1.bb
@@ -19,6 +19,9 @@  CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor"
 
 inherit cargo pkgconfig
 
+CARGO_BUILD_FLAGS:append = "${@' --release' if d.getVar('DEBUG_BUILD') == '1' else ''}"
+BUILD_DIR = "release"
+
 DEBUG_PREFIX_MAP += "-fdebug-prefix-map=${RUSTSRC}/vendor=${TARGET_DBGSRC_DIR}"
 
 do_cargo_setup_snapshot () {