mozjs-128 compilation error for Walnascar
I am new to building yocto. My platform is Raspberrypi5 and I am using yocto 5.2 walnascar. I am trying to build gnome desktop which requires mozjs-128. I have attached the compile log. Some of the errors from the log are below:
error[E0514]: found crate std compiled by an incompatible version of rustc
|
= note: the following crate versions were found:
crate std compiled by rustc 1.84.1 (e71f9a9a9 2025-01-27) (built from a source tarball): /home/ashish/raspberrypi5_latest/poky/build/tmp/work/cortexa76-poky-linux/mozjs-128/128.5.2/recipe-sysroot/usr/lib/rustlib/aarch64-poky-linux-gnu/lib/libstd.rlib crate std compiled by rustc 1.84.1 (e71f9a9a9 2025-01-27) (built from a source tarball): /home/ashish/raspberrypi5_latest/poky/build/tmp/work/cortexa76-poky-linux/mozjs-128/128.5.2/recipe-sysroot/usr/lib/rustlib/aarch64-poky-linux-gnu/lib/libstd.so crate std compiled by rustc 1.84.1 (e71f9a9a9 2025-01-27) (built from a source tarball): /home/ashish/raspberrypi5_latest/poky/build/tmp/work/cortexa76-poky-linux/mozjs-128/128.5.2/recipe-sysroot/usr/lib/rustlib/aarch64-poky-linux-gnu/lib/libstd_detect-2c25b94755d6a597.rmeta crate std compiled by rustc 1.84.1 (e71f9a9a9 2025-01-27) (built from a source tarball): /home/ashish/raspberrypi5_latest/poky/build/tmp/work/cortexa76-poky-linux/mozjs-128/128.5.2/recipe-sysroot/usr/lib/rustlib/aarch64-poky-linux-gnu/lib/libstd_detect-2c25b94755d6a597.rlib = help: please recompile that crate using this compiler (rustc 1.84.1 (e71f9a9a9 2025-01-27)) (consider running cargo clean first)
error[E0514]: found crate core compiled by an incompatible version of rustc
--> /usr/src/debug/mozjs-128/128.5.2/firefox-128.5.2/third_party/rust/stable_deref_trait/src/lib.rs:20:1
|
20 | extern crate core;
| ^^^^^^^^^^^^^^^^^^
|
= note: the following crate versions were found:
crate core compiled by rustc 1.84.1 (e71f9a9a9 2025-01-27) (built from a source tarball): /home/ashish/raspberrypi5_latest/poky/build/tmp/work/cortexa76-poky-linux/mozjs-128/128.5.2/recipe-sysroot/usr/lib/rustlib/aarch64-poky-linux-gnu/lib/libcore-ecb4f00063083b79.rmeta crate core compiled by rustc 1.84.1 (e71f9a9a9 2025-01-27) (built from a source tarball): /home/ashish/raspberrypi5_latest/poky/build/tmp/work/cortexa76-poky-linux/mozjs-128/128.5.2/recipe-sysroot/usr/lib/rustlib/aarch64-poky-linux-gnu/lib/libcore-ecb4f00063083b79.rlib = help: please recompile that crate using this compiler (rustc 1.84.1 (e71f9a9a9 2025-01-27)) (consider running cargo clean first)
error[E0514]: found crate alloc compiled by an incompatible version of rustc
--> /usr/src/debug/mozjs-128/128.5.2/firefox-128.5.2/third_party/rust/stable_deref_trait/src/lib.rs:23:1
|
23 | extern crate alloc;
| ^^^^^^^^^^^^^^^^^^^
|
= note: the following crate versions were found:
crate alloc compiled by rustc 1.84.1 (e71f9a9a9 2025-01-27) (built from a source tarball): /home/ashish/raspberrypi5_latest/poky/build/tmp/work/cortexa76-poky-linux/mozjs-128/128.5.2/recipe-sysroot/usr/lib/rustlib/aarch64-poky-linux-gnu/lib/liballoc-bb33f7f43bb3aeab.rmeta crate alloc compiled by rustc 1.84.1 (e71f9a9a9 2025-01-27) (built from a source tarball): /home/ashish/raspberrypi5_latest/poky/build/tmp/work/cortexa76-poky-linux/mozjs-128/128.5.2/recipe-sysroot/usr/lib/rustlib/aarch64-poky-linux-gnu/lib/liballoc-bb33f7f43bb3aeab.rlib = help: please recompile that crate using this compiler (rustc 1.84.1 (e71f9a9a9 2025-01-27)) (consider running cargo clean first)
error[E0405]: cannot find trait Clone in this scope
--> /usr/src/debug/mozjs-128/128.5.2/firefox-128.5.2/third_party/rust/stable_deref_trait/src/lib.rs:129:50
|
129 | pub unsafe trait CloneStableDeref: StableDeref + Clone {}
| ^^^^^ not found in this scope
error[E0405]: cannot find trait Sized in this scope
--> /usr/src/debug/mozjs-128/128.5.2/firefox-128.5.2/third_party/rust/stable_deref_trait/src/lib.rs:157:17
|
157 | unsafe impl<T: ?Sized> StableDeref for Box<T> {}
| ^^^^^ not found in this scope
error[E0405]: cannot find trait Sized in this scope
--> /usr/src/debug/mozjs-128/128.5.2/firefox-128.5.2/third_party/rust/stable_deref_trait/src/lib.rs:170:17
|
170 | unsafe impl<T: ?Sized> StableDeref for Rc<T> {}
| ^^^^^ not found in this scope
error[E0405]: cannot find trait Sized in this scope
--> /usr/src/debug/mozjs-128/128.5.2/firefox-128.5.2/third_party/rust/stable_deref_trait/src/lib.rs:172:17
|
172 | unsafe impl<T: ?Sized> CloneStableDeref for Rc<T> {}
| ^^^^^ not found in this scope
error[E0405]: cannot find trait Sized in this scope
--> /usr/src/debug/mozjs-128/128.5.2/firefox-128.5.2/third_party/rust/stable_deref_trait/src/lib.rs:174:17
|
174 | unsafe impl<T: ?Sized> StableDeref for Arc<T> {}
| ^^^^^ not found in this scope
error[E0405]: cannot find trait Sized in this scope
--> /usr/src/debug/mozjs-128/128.5.2/firefox-128.5.2/third_party/rust/stable_deref_trait/src/lib.rs:176:17
|
176 | unsafe impl<T: ?Sized> CloneStableDeref for Arc<T> {}
| ^^^^^ not found in this scope
error[E0405]: cannot find trait Sized in this scope
--> /usr/src/debug/mozjs-128/128.5.2/firefox-128.5.2/third_party/rust/stable_deref_trait/src/lib.rs:178:21
|
178 | unsafe impl<'a, T: ?Sized> StableDeref for Ref<'a, T> {}
| ^^^^^ not found in this scope
error[E0405]: cannot find trait Sized in this scope
--> /usr/src/debug/mozjs-128/128.5.2/firefox-128.5.2/third_party/rust/stable_deref_trait/src/lib.rs:179:21
|
179 | unsafe impl<'a, T: ?Sized> StableDeref for RefMut<'a, T> {}
| ^^^^^ not found in this scope
error[E0405]: cannot find trait Sized in this scope
--> /usr/src/debug/mozjs-128/128.5.2/firefox-128.5.2/third_party/rust/stable_deref_trait/src/lib.rs:181:21
|
181 | unsafe impl<'a, T: ?Sized> StableDeref for MutexGuard<'a, T> {}
| ^^^^^ not found in this scope
error[E0405]: cannot find trait Sized in this scope
--> /usr/src/debug/mozjs-128/128.5.2/firefox-128.5.2/third_party/rust/stable_deref_trait/src/lib.rs:183:21
|
183 | unsafe impl<'a, T: ?Sized> StableDeref for RwLockReadGuard<'a, T> {}
| ^^^^^ not found in this scope
error[E0405]: cannot find trait Sized in this scope
--> /usr/src/debug/mozjs-128/128.5.2/firefox-128.5.2/third_party/rust/stable_deref_trait/src/lib.rs:185:21
|
185 | unsafe impl<'a, T: ?Sized> StableDeref for RwLockWriteGuard<'a, T> {}
| ^^^^^ not found in this scope
error[E0405]: cannot find trait Sized in this scope
--> /usr/src/debug/mozjs-128/128.5.2/firefox-128.5.2/third_party/rust/stable_deref_trait/src/lib.rs:187:21
|
187 | unsafe impl<'a, T: ?Sized> StableDeref for &'a T {}
| ^^^^^ not found in this scope
error[E0405]: cannot find trait Sized in this scope
--> /usr/src/debug/mozjs-128/128.5.2/firefox-128.5.2/third_party/rust/stable_deref_trait/src/lib.rs:188:21
|
188 | unsafe impl<'a, T: ?Sized> CloneStableDeref for &'a T {}
| ^^^^^ not found in this scope
error[E0405]: cannot find trait Sized in this scope
--> /usr/src/debug/mozjs-128/128.5.2/firefox-128.5.2/third_party/rust/stable_deref_trait/src/lib.rs:189:21
Quoted 6 lines · On 7/1/25 17:42, ashish shrikhande6 via lists.yoctoproject.org wrote:
I am new to building yocto. My platform is Raspberrypi5 and I am using yocto 5.2 walnascar. I am trying to build gnome desktop which requires mozjs-128.
I have attached the compile log. Some of the errors from the log are below:
This part of the log looks strange:
"CARGO=/home/ashish/.rustup/toolchains/1.84.1-x86_64-unknown-linux-gnu/bin/cargo" (this is the first env var set before by the first failing command).
This seems to indicate that for some reason your build machine's local Rust installation is used to compile mozjs instead of using the Rust toolchain provided by Yocto.
Have you changed anything Cargo/Rust related (or any toolchain related things) in the recipe or in the layers you are using?
(In general Yocto is a self-contained framework that takes care of the toolchain and its configuration also with usable defaults, without the need to tweak these most of the time)
No I did not change anything in the recipe or layers. mozjs-128 recipe I have attached here. I just took Walnascar as it is.
Do I need to add meta-rust in my yocto?
Quoted 2 lines · On 7/2/25 01:14, ashish shrikhande6 via lists.yoctoproject.org wrote:
Do I need to add meta-rust in my yocto?
No, you do not - Walnascar comes with a reasonably new Rust toolchain on its own.
I wonder if maybe it clashes somehow with the existing PATH...
If you check your PATH environment variable, does it contain "/home/ashish/.rustup/toolchains/1.84.1-x86_64-unknown-linux-gnu/bin/"? If yes, could you remove it at least temporarily, run "bitbake -c clean mozjs-128", and try to build again to see what's the result?
I removed rust and it successfully compiled mozjs. Thank you for suggestion.