rust: add missing zlib and zstd dependencies
PATCH v2 1/5 rust: add missing zlib and zstd dependencies
From: Peter Tatrai <[email protected]>
LLVM requires zlib and zstd support for compression routines used by rustc_codegen_llvm and related components.
Recipe-level RUSTFLAGS are not propagated in qemu image, causing bootstrap test linkage failures. When these libraries are absent in the selftest execution environment, bootstrap test binaries fail to link and cause following failure:
error: linking with target-rust-ccld failed: exit status: 1 = note: undefined reference to `compress2'
= note: undefined reference to `uncompress'
= note: undefined reference to `ZSTD_decompress'
= note: undefined reference to `ZSTD_isError'
= note: undefined reference to `ZSTD_compress2'
= note: undefined reference to `crc32'
Explicitly pass -lz and -lzstd in the image and ensure the corresponding runtime libraries are present in the image.
It was initially reported on qemuppc and later seen across all tested architectures (arm32/64, riscv64, x86_32/64).
https://lists.openembedded.org/g/openembedded-core/message/225636
--- meta/lib/oeqa/selftest/cases/rust.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
meta/lib/oeqa/selftest/cases/rust.py +2 -2
@@ -47,7 +47,7 @@ class RustSelfTestSystemEmulated(OESelftestTestCase, OEPTestResultTestCase): bitbake("{} -c test_compile".format(recipe)) builddir = get_bb_var("RUSTSRC", "rust") # build core-image-minimal with required packages - default_installed_packages = ["libgcc", "libstdc++", "libatomic", "libgomp"] + default_installed_packages = ["libgcc", "libstdc++", "libatomic", "libgomp", "libzstd"] features = [] features.append('IMAGE_FEATURES += "ssh-server-dropbear"') features.append('CORE_IMAGE_EXTRA_INSTALL += "{0}"'.format(" ".join(default_installed_packages)))
@@ -124,7 +124,7 @@ class RustSelfTestSystemEmulated(OESelftestTestCase, OEPTestResultTestCase): cmd = cmd + " export RUST_TARGET_PATH=%s/rust-targets;" % rustlibpath # Strip debug symbols from test binaries to reduce size (300+ MB -> ~140 MB) # PowerPC mac99 QEMU has 768MB RAM limit, so we need to minimize test binary sizes - cmd = cmd + " export RUSTFLAGS='-C strip=debuginfo';" + cmd = cmd + " export RUSTFLAGS='-C strip=debuginfo -Clink-arg=-lz -Clink-arg=-lzstd';" # Trigger testing. cmd = cmd + " export TEST_DEVICE_ADDR=\"%s:12345\";" % qemu.ip cmd = cmd + " cd %s; python3 src/bootstrap/bootstrap.py test %s --target %s" % (builddir, testargs, targetsys)
Signature · 1 line
2.49.0
PATCH v2 2/5 rust: Exclude tier-check and fix openssl-sys build error
From: Yash Shinde <[email protected]>
- Exclude tier-check which fails due to file not found error.
Testing stage2 platform support check (x86_64-poky-linux-gnu)
Compiling tier-check v0.1.0 (/srv/pokybuild/yocto-worker/qemux86-64-tc/build/build-st-1400964/tmp/work/x86-64-v3-poky-linux/rust/1.91.1/sources/rustc-1.91.1-src/src/tools/tier-check) thread 'main' (163263) panicked at src/tools/tier-check/src/main.rs:16:10:
rustc should run: Os { code: 2, kind: NotFound, message: "No such file or directory" }
Reported: https://github.com/rust-lang/rust/issues/149171
- Fix following error by providing openssl in the image:
error: failed to run custom build command for openssl-sys v0.9.109
Failed to find OpenSSL development headers.
You can try fixing this setting the OPENSSL_DIR environment variable pointing to your OpenSSL installation or installing OpenSSL headers package specific to your distribution.
- Exclude "tests/assembly-llvm/c-variadic-arm.rs" failing on arm32.
--- meta/lib/oeqa/selftest/cases/rust.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
meta/lib/oeqa/selftest/cases/rust.py +5 -1
@@ -47,7 +47,7 @@ class RustSelfTestSystemEmulated(OESelftestTestCase, OEPTestResultTestCase): bitbake("{} -c test_compile".format(recipe)) builddir = get_bb_var("RUSTSRC", "rust") # build core-image-minimal with required packages - default_installed_packages = ["libgcc", "libstdc++", "libatomic", "libgomp", "libzstd"] + default_installed_packages = ["libgcc", "libstdc++", "libatomic", "libgomp", "libzstd", "openssl"] features = [] features.append('IMAGE_FEATURES += "ssh-server-dropbear"') features.append('CORE_IMAGE_EXTRA_INSTALL += "{0}"'.format(" ".join(default_installed_packages)))
@@ -75,9 +75,11 @@ class RustSelfTestSystemEmulated(OESelftestTestCase, OEPTestResultTestCase): 'src/tools/rustdoc-themes', 'src/tools/rust-installer', 'src/tools/test-float-parse', + 'src/tools/tier-check', 'src/tools/suggest-tests', 'src/tools/tidy', 'tests/assembly-llvm/asm/aarch64-outline-atomics.rs', + 'tests/assembly-llvm/c-variadic-arm.rs', 'tests/codegen-llvm/issues/issue-122805.rs', 'tests/codegen-llvm/thread-local.rs', 'tests/mir-opt/',
@@ -117,9 +119,11 @@ class RustSelfTestSystemEmulated(OESelftestTestCase, OEPTestResultTestCase): targetsys = get_bb_var("RUST_TARGET_SYS", "rust") rustlibpath = get_bb_var("WORKDIR", "rust") tmpdir = get_bb_var("TMPDIR", "rust") + staging_dir_native = get_bb_var("STAGING_DIR_NATIVE", "core-image-minimal") # Set path for target-poky-linux-gcc, RUST_TARGET_PATH and hosttools. cmd = "export TARGET_VENDOR=\"-poky\";" + cmd = cmd + " export OPENSSL_DIR=%s/usr;" %(staging_dir_native) cmd = cmd + " export PATH=%s/recipe-sysroot-native/usr/bin/python3-native:%s/recipe-sysroot-native/usr/bin:%s/recipe-sysroot-native/usr/bin/%s:%s/hosttools:$PATH;" % (rustlibpath, rustlibpath, rustlibpath, tcpath, tmpdir) cmd = cmd + " export RUST_TARGET_PATH=%s/rust-targets;" % rustlibpath # Strip debug symbols from test binaries to reduce size (300+ MB -> ~140 MB)
Signature · 1 line
2.49.0
PATCH v2 3/5 rust: Upgrade 1.90.0 -> 1.91.0
In reply to [email protected]From: Yash Shinde <[email protected]>
https://blog.rust-lang.org/2025/10/30/Rust-1.91.0/
* Recent updates to rustc now require 'target_pointer_width' to be specified as an integer.
Cast it to 'int' in rust target configuration to resolve the type consistency error.
https://github.com/rust-lang/rust/pull/144443
* The "remote-test-server" bin is now generated in stage2-tools-bin dir rather than stage1. Update the test suite and recipe accordingly.
* Rebase existing patches with v1.91.0.
* Drop merged patches with rust v1.91.0.
- 0001-libunwind-Use-gcs-instead-of-gcs-target-attribute.patch
https://github.com/llvm/llvm-project/pull/138077/commits/bcc31a9384d2df1c0f27ef140e1f0f9ee493034f
---
.../classes-recipe/rust-target-config.bbclass | 2 +-
meta/conf/distro/include/tcmode-default.inc | 2 +-
meta/lib/oeqa/selftest/cases/rust.py | 2 +-
.../rust/{cargo_1.90.0.bb => cargo_1.91.0.bb} | 0
...-gcs-instead-of-gcs-target-attribute.patch | 66 ----------------
...teps-tool.rs-switch-off-lto-for-rust.patch | 20 ++---
.../rust/files/rust-oe-selftest.patch | 59 +++++---------
...ibstd-rs_1.90.0.bb => libstd-rs_1.91.0.bb} | 0
....90.0.bb => rust-cross-canadian_1.91.0.bb} | 0
meta/recipes-devtools/rust/rust-snapshot.inc | 78 +++++++++----------
meta/recipes-devtools/rust/rust-source.inc | 3 +-
.../rust/{rust_1.90.0.bb => rust_1.91.0.bb} | 4 +-
12 files changed, 74 insertions(+), 162 deletions(-)
rename meta/recipes-devtools/rust/{cargo_1.90.0.bb => cargo_1.91.0.bb} (100%)
delete mode 100644 meta/recipes-devtools/rust/files/0001-libunwind-Use-gcs-instead-of-gcs-target-attribute.patch
rename meta/recipes-devtools/rust/{libstd-rs_1.90.0.bb => libstd-rs_1.91.0.bb} (100%)
rename meta/recipes-devtools/rust/{rust-cross-canadian_1.90.0.bb => rust-cross-canadian_1.91.0.bb} (100%)
rename meta/recipes-devtools/rust/{rust_1.90.0.bb => rust_1.91.0.bb} (99%)meta/classes-recipe/rust-target-config.bbclass +1 -1
@@ -385,7 +385,7 @@ def rust_gen_target(d, thing, wd, arch): if tspec['data-layout'] is None: bb.fatal("No rust target defined for %s" % arch_abi) tspec['max-atomic-width'] = int(d.getVarFlag('MAX_ATOMIC_WIDTH', arch_abi)) - tspec['target-pointer-width'] = d.getVarFlag('TARGET_POINTER_WIDTH', arch_abi) + tspec['target-pointer-width'] = int(d.getVarFlag('TARGET_POINTER_WIDTH', arch_abi)) tspec['target-c-int-width'] = int(d.getVarFlag('TARGET_C_INT_WIDTH', arch_abi)) tspec['target-endian'] = d.getVarFlag('TARGET_ENDIAN', arch_abi) tspec['arch'] = arch_to_rust_target_arch(rust_arch)
meta/conf/distro/include/tcmode-default.inc +1 -1
@@ -12,7 +12,7 @@ PREFERRED_PROVIDER_virtual/gettext ??= "gettext" GCCVERSION ?= "15.%" SDKGCCVERSION ?= "${GCCVERSION}" GLIBCVERSION ?= "2.42%" -RUSTVERSION ?= "1.90.0%" +RUSTVERSION ?= "1.91.0%" PREFERRED_VERSION_gcc ?= "${GCCVERSION}" PREFERRED_VERSION_gcc-cross-${TARGET_ARCH} ?= "${GCCVERSION}"
meta/lib/oeqa/selftest/cases/rust.py +1 -1
@@ -110,7 +110,7 @@ class RustSelfTestSystemEmulated(OESelftestTestCase, OEPTestResultTestCase): # Copy remote-test-server to image through scp host_sys = get_bb_var("RUST_BUILD_SYS", "rust") ssh = SSHControl(ip=qemu.ip, logfile=qemu.sshlog, user="root") - ssh.copy_to(builddir + "/build/" + host_sys + "/stage1-tools-bin/remote-test-server","~/") + ssh.copy_to(builddir + "/build/" + host_sys + "/stage2-tools-bin/remote-test-server","~/") # Execute remote-test-server on image through background ssh command = '~/remote-test-server --bind 0.0.0.0:12345 -v' sshrun=subprocess.Popen(("ssh", '-o', 'UserKnownHostsFile=/dev/null', '-o', 'StrictHostKeyChecking=no', '-f', "root@%s" % qemu.ip, command), shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
meta/recipes-devtools/rust/cargo_1.91.0.bb renamed from meta/recipes-devtools/rust/cargo_1.90.0.bb +0 -0
meta/recipes-devtools/rust/files/0001-libunwind-Use-gcs-instead-of-gcs-target-attribute.patch deleted +0 -66
66 lines not on this page · raw message
meta/recipes-devtools/rust/files/0001-src-core-build_steps-tool.rs-switch-off-lto-for-rust.patch +11 -9
@@ -24,9 +24,9 @@ diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core index 087df2f8a..00790affb 100644 --- a/src/bootstrap/src/core/build_steps/tool.rs +++ b/src/bootstrap/src/core/build_steps/tool.rs -@@ -16,14 +16,12 @@ use std::{env, fs}; - #[cfg(feature = "tracing")] - use tracing::instrument; +@@ -13,14 +13,12 @@ use std::ffi::OsStr; + use std::path::PathBuf; + use std::{env, fs}; -use crate::core::build_steps::compile::is_lto_stage; use crate::core::build_steps::toolstate::ToolState;
@@ -41,14 +41,16 @@ index 087df2f8a..00790affb 100644 +use crate::core::config::{DebuginfoLevel, TargetSelection}; use crate::utils::exec::{BootstrapCommand, command}; use crate::utils::helpers::{add_dylib_path, exe, t}; - use crate::{Compiler, FileType, Kind, Mode, gha}; -@@ -160,20 +158,7 @@ impl Step for ToolBuild { + use crate::{Compiler, FileType, Kind, Mode}; +@@ -121,22 +119,7 @@ impl Step for ToolBuild { cargo.env("RUSTC_WRAPPER", ccache); } -- // Rustc tools (miri, clippy, cargo, rustfmt, rust-analyzer) +- // RustcPrivate tools (miri, clippy, rustfmt, rust-analyzer) and cargo - // could use the additional optimizations. -- if self.mode == Mode::ToolRustc && is_lto_stage(&self.build_compiler) { +- if is_lto_stage(&self.build_compiler) +- && (self.mode == Mode::ToolRustcPrivate || self.path == "src/tools/cargo") +- { - let lto = match builder.config.rust_lto { - RustcLto::Off => Some("off"), - RustcLto::Thin => Some("thin"),
@@ -67,7 +69,7 @@ index 087df2f8a..00790affb 100644 diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs --- a/src/bootstrap/src/core/builder/mod.rs +++ b/src/bootstrap/src/core/builder/mod.rs -@@ -13,7 +13,7 @@ +@@ -13,7 +13,7 @@ use clap::ValueEnum; #[cfg(feature = "tracing")] use tracing::instrument;
@@ -75,4 +77,4 @@ diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/buil +pub use self::cargo::Cargo; pub use crate::Compiler; use crate::core::build_steps::compile::{Std, StdLink}; - use crate::core::build_steps::{ + use crate::core::build_steps::tool::RustcPrivateCompilers;
meta/recipes-devtools/rust/files/rust-oe-selftest.patch +18 -41
153 lines not on this page · raw message
meta/recipes-devtools/rust/libstd-rs_1.91.0.bb renamed from meta/recipes-devtools/rust/libstd-rs_1.90.0.bb +0 -0
meta/recipes-devtools/rust/rust-cross-canadian_1.91.0.bb renamed from meta/recipes-devtools/rust/rust-cross-canadian_1.90.0.bb +0 -0
meta/recipes-devtools/rust/rust-snapshot.inc +39 -39
95 lines not on this page · raw message
meta/recipes-devtools/rust/rust-source.inc +1 -2
@@ -7,10 +7,9 @@ SRC_URI += "https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz;n file://oeqa-selftest-Increase-timeout-in-process-sigpipe-ru.patch;patchdir=${RUSTSRC} \ file://0001-src-core-build_steps-tool.rs-switch-off-lto-for-rust.patch;patchdir=${RUSTSRC} \ file://revert-link-std-statically-in-rustc_driver-feature.patch;patchdir=${RUSTSRC} \ - file://0001-libunwind-Use-gcs-instead-of-gcs-target-attribute.patch;patchdir=${RUSTSRC} \ file://0001-riscv32-Define-plain-syscalls-as-their-time64-varian.patch;patchdir=${RUSTSRC} \ " -SRC_URI[rust.sha256sum] = "6bfeaddd90ffda2f063492b092bfed925c4b8c701579baf4b1316e021470daac" +SRC_URI[rust.sha256sum] = "9b94161dba3aa32192e0e75f7891912d98095ffb86087b07a05af35a0265a938" RUSTSRC = "${UNPACKDIR}/rustc-${RUST_VERSION}-src"
meta/recipes-devtools/rust/rust_1.91.0.bb renamed from meta/recipes-devtools/rust/rust_1.90.0.bb +2 -2
@@ -293,7 +293,7 @@ rust_do_install:class-nativesdk() { install -d ${D}${bindir} for i in cargo-clippy clippy-driver rustfmt; do - cp build/${RUST_BUILD_SYS}/stage1-tools/${RUST_HOST_SYS}/release/$i ${D}${bindir} + cp build/${RUST_BUILD_SYS}/stage2-tools/${RUST_HOST_SYS}/release/$i ${D}${bindir} patchelf --set-rpath "\$ORIGIN/../lib" ${D}${bindir}/$i done
@@ -328,7 +328,7 @@ rust_do_install:class-target() { install -d ${D}${bindir} for i in ${EXTRA_TOOLS}; do - cp build/${RUST_BUILD_SYS}/stage1-tools/${RUST_HOST_SYS}/release/$i ${D}${bindir} + cp build/${RUST_BUILD_SYS}/stage2-tools/${RUST_HOST_SYS}/release/$i ${D}${bindir} patchelf --set-rpath "\$ORIGIN/../lib" ${D}${bindir}/$i done
Signature · 1 line
2.49.0
PATCH v2 4/5 rust: remove passing tests from excluded and ignored list.
In reply to [email protected]From: Yash Shinde <[email protected]>
Remove the ignore tags for passing riscv64 tests and drop obsolete "tests/codegen-llvm/issues/issue-122805.rs" from exclude test list.
The test was renamed to "dont-shuffle-bswaps.rs" and passes now:
https://github.com/rust-lang/rust/commit/3580698996f6da6f006477809d7959bffcfd3bf0
--- meta/lib/oeqa/selftest/cases/rust.py | 1 - .../rust/files/rust-oe-selftest.patch | 100 ------------------ 2 files changed, 101 deletions(-)
meta/lib/oeqa/selftest/cases/rust.py +0 -1
@@ -80,7 +80,6 @@ class RustSelfTestSystemEmulated(OESelftestTestCase, OEPTestResultTestCase): 'src/tools/tidy', 'tests/assembly-llvm/asm/aarch64-outline-atomics.rs', 'tests/assembly-llvm/c-variadic-arm.rs', - 'tests/codegen-llvm/issues/issue-122805.rs', 'tests/codegen-llvm/thread-local.rs', 'tests/mir-opt/', 'tests/run-make',
meta/recipes-devtools/rust/files/rust-oe-selftest.patch +0 -100
106 lines not on this page · raw message
Signature · 1 line
2.49.0
PATCH v2 5/5 rust: Upgrade 1.91.0 -> 1.91.1
In reply to [email protected]From: Yash Shinde <[email protected]>
https://blog.rust-lang.org/2025/11/10/Rust-1.91.1/
Test results summary:
rust v1.91.1
+-----------+--------+---------+ | Machine | Passed | Ignored | +-----------+--------+---------+ | arm-32 | 29,968 | 1,510 | | arm-64 | 30,071 | 1,447 | | x86-32 | 29,985 | 1,489 | | x86-64 | 30,229 | 1,247 | | riscv-64 | 30,045 | 1,472 | +-----------+--------+---------+
Test results difference (1.91.1 - 1.90):
+-----------+--------+---------+ | Machine | Passed | Ignored | +-----------+--------+---------+ | arm-32 | +451 | -19 | | arm-64 | +463 | -24 | | x86-32 | +477 | -18 | | x86-64 | +326 | -28 | | riscv-64 | +461 | -22 | +-----------+--------+---------+
---
meta/conf/distro/include/tcmode-default.inc | 2 +-
meta/recipes-devtools/rust/{cargo_1.91.0.bb => cargo_1.91.1.bb} | 0
.../rust/{libstd-rs_1.91.0.bb => libstd-rs_1.91.1.bb} | 0
...t-cross-canadian_1.91.0.bb => rust-cross-canadian_1.91.1.bb} | 0
meta/recipes-devtools/rust/rust-source.inc | 2 +-
meta/recipes-devtools/rust/{rust_1.91.0.bb => rust_1.91.1.bb} | 0
6 files changed, 2 insertions(+), 2 deletions(-)
rename meta/recipes-devtools/rust/{cargo_1.91.0.bb => cargo_1.91.1.bb} (100%)
rename meta/recipes-devtools/rust/{libstd-rs_1.91.0.bb => libstd-rs_1.91.1.bb} (100%)
rename meta/recipes-devtools/rust/{rust-cross-canadian_1.91.0.bb => rust-cross-canadian_1.91.1.bb} (100%)
rename meta/recipes-devtools/rust/{rust_1.91.0.bb => rust_1.91.1.bb} (100%)meta/conf/distro/include/tcmode-default.inc +1 -1
@@ -12,7 +12,7 @@ PREFERRED_PROVIDER_virtual/gettext ??= "gettext" GCCVERSION ?= "15.%" SDKGCCVERSION ?= "${GCCVERSION}" GLIBCVERSION ?= "2.42%" -RUSTVERSION ?= "1.91.0%" +RUSTVERSION ?= "1.91.1%" PREFERRED_VERSION_gcc ?= "${GCCVERSION}" PREFERRED_VERSION_gcc-cross-${TARGET_ARCH} ?= "${GCCVERSION}"
meta/recipes-devtools/rust/cargo_1.91.1.bb renamed from meta/recipes-devtools/rust/cargo_1.91.0.bb +0 -0
meta/recipes-devtools/rust/libstd-rs_1.91.1.bb renamed from meta/recipes-devtools/rust/libstd-rs_1.91.0.bb +0 -0
meta/recipes-devtools/rust/rust-cross-canadian_1.91.1.bb renamed from meta/recipes-devtools/rust/rust-cross-canadian_1.91.0.bb +0 -0
meta/recipes-devtools/rust/rust-source.inc +1 -1
@@ -9,7 +9,7 @@ SRC_URI += "https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz;n file://revert-link-std-statically-in-rustc_driver-feature.patch;patchdir=${RUSTSRC} \ file://0001-riscv32-Define-plain-syscalls-as-their-time64-varian.patch;patchdir=${RUSTSRC} \ " -SRC_URI[rust.sha256sum] = "9b94161dba3aa32192e0e75f7891912d98095ffb86087b07a05af35a0265a938" +SRC_URI[rust.sha256sum] = "66401bb815e236cc6b2aacbbe23b61b286c1fe27a67902e7c0222cfe77b3dbab" RUSTSRC = "${UNPACKDIR}/rustc-${RUST_VERSION}-src"
meta/recipes-devtools/rust/rust_1.91.1.bb renamed from meta/recipes-devtools/rust/rust_1.91.0.bb +0 -0
Signature · 1 line
2.49.0