Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Yash.Shinde@windriver.com
To: openembedded-core@lists.openembedded.org
Cc: Randy.MacLeod@windriver.com, Naveen.Gowda@windriver.com,
	Sundeep.Kokkonda@windriver.com, Yash.Shinde@windriver.com
Subject: [PATCH] cargo: Increase RUST_MIN_STACK size to avoid SIGSEGV in DEBUG builds only.
Date: Wed, 30 Oct 2024 04:16:01 -0700	[thread overview]
Message-ID: <20241030111601.284064-1-Yash.Shinde@windriver.com> (raw)

From: Yash Shinde <Yash.Shinde@windriver.com>

For some Rust crates, like building p384 in DEBUG mode, a SIGSEGV
is encountered as follows:

     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
     note: backtrace dumped due to SIGSEGV! resuming signal
     error: could not compile `p384` (lib)

WARNING: Backtrace (BB generated script):
        #1: oe_cargo_build, /home/poky/build/tmp/work/core2-32-wrs-linux/cargo/1.79.0/temp/run.do_compile.3262358, line 193
        #2: cargo_do_compile, /home/poky/build/tmp/work/core2-32-wrs-linux/cargo/1.79.0/temp/run.do_compile.3262358, line 165
        #3: do_compile, /home/poky/build/tmp/work/core2-32-wrs-linux/cargo/1.79.0/temp/run.do_compile.3262358, line 160
        #4: main, /home/poky/build/tmp/work/core2-32-wrs-linux/cargo/1.79.0/temp/run.do_compile.3262358, line 206

Setting RUST_MIN_STACK to 8MB conditionally for DEBUG builds only handles
the stack overflow and SIGSEGV.

References: https://github.com/esp-rs/rust/issues/214
            https://github.com/rust-lang/rust/issues/122357
            https://github.com/rust-lang/rust/pull/122847#issue-2201254359
            https://github.com/rust-lang/rust/pull/122847/commits

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

diff --git a/meta/recipes-devtools/rust/cargo_1.79.0.bb b/meta/recipes-devtools/rust/cargo_1.79.0.bb
index 123032cdf7..4917b25c0c 100644
--- a/meta/recipes-devtools/rust/cargo_1.79.0.bb
+++ b/meta/recipes-devtools/rust/cargo_1.79.0.bb
@@ -37,6 +37,9 @@ do_cargo_setup_snapshot[vardepsexclude] += "UNINATIVE_LOADER"
 
 do_compile:prepend () {
 	export RUSTC_BOOTSTRAP="1"
+	if [ "${DEBUG_BUILD}" = "1" ]; then
+		export RUST_MIN_STACK=8388608
+	fi
 }
 
 do_install () {
-- 
2.43.0



             reply	other threads:[~2024-10-30 11:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-30 11:16 Yash.Shinde [this message]
2024-10-30 11:20 ` [PATCH] cargo: Increase RUST_MIN_STACK size to avoid SIGSEGV in DEBUG builds only Yash Shinde
2024-10-30 14:24 ` Randy MacLeod
2024-10-31  9:35   ` Yash Shinde
2024-10-31 14:02     ` Randy MacLeod
2024-11-14 11:02       ` Yash Shinde
2024-11-14 12:01         ` [OE-core] " Richard Purdie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241030111601.284064-1-Yash.Shinde@windriver.com \
    --to=yash.shinde@windriver.com \
    --cc=Naveen.Gowda@windriver.com \
    --cc=Randy.MacLeod@windriver.com \
    --cc=Sundeep.Kokkonda@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox