Build libstd-rs in release mode to compile mozjs

Message ID 20211206054504.61115-1-pgowda.cve@gmail.com
State New
Headers show
Series Build libstd-rs in release mode to compile mozjs | expand

Commit Message

Pgowda Dec. 6, 2021, 5:45 a.m. UTC
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

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.

Signed-off-by: pgowda <pgowda.cve@gmail.com>
---
 meta/recipes-devtools/rust/libstd-rs.inc | 3 +++
 1 file changed, 3 insertions(+)

Comments

Alexander Kanavin Dec. 6, 2021, 8:20 a.m. UTC | #1
On Mon, 6 Dec 2021 at 06:45, pgowda <pgowda.cve@gmail.com> wrote:

> 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
>
> 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.
>

Thank you, but I think the problem needs to be properly understood before
any fix to oe-core is merged. Can you keep the workaround as a bbappend
until then?

Alex
Randy MacLeod Dec. 8, 2021, 1:51 a.m. UTC | #2
On 2021-12-06 3:20 a.m., Alexander Kanavin wrote:
> On Mon, 6 Dec 2021 at 06:45, pgowda <pgowda.cve@gmail.com 
> <mailto:pgowda.cve@gmail.com>> wrote:
> 
>     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
>     <http://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.
> 
> 
> Thank you, but I think the problem needs to be properly understood 
> before any fix to oe-core is merged. Can you keep the workaround as a 
> bbappend until then?

That's fine. We (WR) have this as an open bug so Naveen will
work on getting to the root cause.

CCing Khem in case he want's the work-around in meta-oe.

../Randy

> 
> Alex
> 
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#159212): https://lists.openembedded.org/g/openembedded-core/message/159212
> Mute This Topic: https://lists.openembedded.org/mt/87534858/3616765
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [randy.macleod@windriver.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>

Patch

diff --git a/meta/recipes-devtools/rust/libstd-rs.inc b/meta/recipes-devtools/rust/libstd-rs.inc
index 987956344a..96eaa2bdc0 100644
--- a/meta/recipes-devtools/rust/libstd-rs.inc
+++ b/meta/recipes-devtools/rust/libstd-rs.inc
@@ -19,9 +19,12 @@  RUSTFLAGS += "-L ${STAGING_LIBDIR} -C link-arg=-Wl,-soname,libstd.so"
 
 S = "${RUSTSRC}/src/libstd"
 
+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}"