Skip to contentSkip to conversation

libstd-rs: Build in the release mode to avoid error Issue: LINCD-7172

DISCUSSION Randy MacLeod 1 participant 1 message Jan 9, 2023 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 6 lines · Yash Shinde

When mozjs in firefox is built with DEBUG_BUILD = "1"
in local.conf, it will fail with the following error:
rustc-1.56.0-src/vendor/compiler_builtins/src/int/specialized_div_rem
/asymmetric.rs:57:
more undefined references to `core::panicking::panic' follow

Quoted 6 lines

Switch to building libstd-rs in "release" mode as that works around the issue and builds mozjs successfully. This is a work-around that can be used until the root cause of the debug build error is resolved.

(LOCAL REV: NOT UPSTREAM) -- to be sent to oe-core

Drop the line above, it's only used internally for WR Linux.

Quoted 22 lines
---
  .../rust/rust/LINCD-11387.patch               | 43 +++++++++++++++++++
  1 file changed, 43 insertions(+)

create mode 100644 meta/recipes-devtools/rust/rust/LINCD-11387.patch

meta/recipes-devtools/rust/rust/LINCD-11387.patch new file +9 -0
new file mode 100644
index 0000000000..3e84aa7232
@@ -0,0 +1,43 @@
+From 45731fb0f735bc287e56b6fd6c93b56966195647 Mon Sep 17 00:00:00 2001
+From: naveen gowda <[email protected]>
+Date: Mon, 29 Nov 2021 21:40:27 -0800
+Subject: libstd-rs: Build in the release mode to avoid error
+
+Issue: LINCD-7172
+
+When mozjs in firefox is built with DEBUG_BUILD = "1"
+in local.conf, it will fail with the following error:

meta/recipes-devtools/rust/rust/LINCD-11387.patch line 19

Quoted 10 lines
meta/recipes-devtools/rust/rust/LINCD-11387.patch new file +10 -0
+   rustc-1.56.0-src/vendor/compiler_builtins/src/int/specialized_div_rem
+/asymmetric.rs:57:
+   more undefined references to `core::panicking::panic' follow
+
+Switch to building libstd-rs in "release" mode as that works
+around the issue and builds mozjs successfully. This is a
+work-around that can be used until the root cause of the debug
+build error is resolved.
+
+(LOCAL REV: NOT UPSTREAM) -- to be sent to oe-core

Drop the line above, it's only used internally for WR Linux.

We also need an upstream status.
If you haven't done so already please find and report or create a new upstream issue to track this problem and include it as part of the Upstream-Status:

https://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded

-> https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines#Patch_Header_Recommendations:_Upstream-Status

Note that the Upstream-Status is mandatory for oe-core.

../Randy

Quoted 24 lines
meta/recipes-devtools/rust/rust/LINCD-11387.patch new file +24 -0
+
+Signed-off-by: naveen gowda <[email protected]>
+Signed-off-by: Randy MacLeod <[email protected]>
+---
+meta/recipes-devtools/rust/libstd-rs_1.66.0.bb | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/meta/recipes-devtools/rust/libstd-rs_1.66.0.bb b/meta/recipes-devtools/rust/libstd-rs_1.66.0.bb
+index 8802e9790c..c5295187f8 100644
+--- a/meta/recipes-devtools/rust/libstd-rs_1.66.0.bb
++++ b/meta/recipes-devtools/rust/libstd-rs_1.66.0.bb
+@@ -24,9 +24,12 @@ RUSTFLAGS += "-Cembed-bitcode=yes"
+ # Needed so cargo can find libbacktrace
+ RUSTFLAGS += "-L ${STAGING_LIBDIR} -C link-arg=-Wl,-soname,libstd.so"
+
++CARGO_BUILD_FLAGS:append = "${@' --release' if d.getVar('DEBUG_BUILD') == '1' else ''}"
++
+ CARGO_FEATURES ?= "panic-unwind backtrace"
+ CARGO_BUILD_FLAGS += "--features '${CARGO_FEATURES}'"
+ CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor"
++BUILD_DIR = "release"
+
+ do_compile:prepend () {
+     export CARGO_TARGET_DIR="${B}"
Signature · 2 lines
# Randy MacLeod
# Wind River Linux