From: Alexander Kanavin <alex.kanavin@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Alexander Kanavin <alex@linutronix.de>
Subject: [PATCH 3/4] rust: use rust-snapshot binaries only in rust-native
Date: Thu, 16 May 2024 13:21:10 +0200 [thread overview]
Message-ID: <20240516112111.2145436-3-alex.kanavin@gmail.com> (raw)
In-Reply-To: <20240516112111.2145436-1-alex.kanavin@gmail.com>
From: Alexander Kanavin <alex@linutronix.de>
Otherwise, use rust-native and cargo-native binaries as that allows
our native tweaks in them to be used for target/nativesdk rust -
same as for everything else written in rust.
In particular, this allows building target rust with
cargo-native that includes important reproducibility tweaks.
Unfortunately, this also breaks rust selftest, and that
is partially addressed by the following commit.
[YOCTO #15185]
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
meta/recipes-devtools/rust/rust_1.75.0.bb | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/meta/recipes-devtools/rust/rust_1.75.0.bb b/meta/recipes-devtools/rust/rust_1.75.0.bb
index 8ef838ee90c..e82a7395e44 100644
--- a/meta/recipes-devtools/rust/rust_1.75.0.bb
+++ b/meta/recipes-devtools/rust/rust_1.75.0.bb
@@ -11,6 +11,11 @@ DEPENDS += "file-native python3-native"
DEPENDS:append:class-native = " rust-llvm-native"
DEPENDS:append:class-nativesdk = " nativesdk-rust-llvm"
+# native rust uses cargo/rustc from binary snapshots to bootstrap
+# but everything else should use our native builds
+DEPENDS:append:class-target = " cargo-native rust-native"
+DEPENDS:append:class-nativesdk = " cargo-native rust-native"
+
DEPENDS += "rust-llvm (=${PV})"
RDEPENDS:${PN}:append:class-target = " gcc g++ binutils"
@@ -68,6 +73,11 @@ addtask do_test_compile after do_configure do_rust_gen_targets
do_rust_setup_snapshot[dirs] += "${WORKDIR}/rust-snapshot"
do_rust_setup_snapshot[vardepsexclude] += "UNINATIVE_LOADER"
+RUSTC_BOOTSTRAP = "${STAGING_BINDIR_NATIVE}/rustc"
+CARGO_BOOTSTRAP = "${STAGING_BINDIR_NATIVE}/cargo"
+RUSTC_BOOTSTRAP:class-native = "${WORKDIR}/rust-snapshot/bin/rustc"
+CARGO_BOOTSTRAP:class-native = "${WORKDIR}/rust-snapshot/bin/cargo"
+
python do_configure() {
import json
import configparser
@@ -141,10 +151,10 @@ python do_configure() {
config.set("build", "docs", e(False))
config.set("build", "tools", ["rust-demangler",])
- rustc = d.expand("${WORKDIR}/rust-snapshot/bin/rustc")
+ rustc = d.getVar('RUSTC_BOOTSTRAP')
config.set("build", "rustc", e(rustc))
- cargo = d.expand("${WORKDIR}/rust-snapshot/bin/cargo")
+ cargo = d.getVar('CARGO_BOOTSTRAP')
config.set("build", "cargo", e(cargo))
config.set("build", "vendor", e(True))
--
2.39.2
next prev parent reply other threads:[~2024-05-16 11:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-16 11:21 [PATCH 1/4] rust: correctly link rust-snapshot into build/stage0 Alexander Kanavin
2024-05-16 11:21 ` [PATCH 2/4] rust: add reproducibility patch to eliminate host leakage Alexander Kanavin
2024-05-16 11:21 ` Alexander Kanavin [this message]
2024-05-16 11:21 ` [PATCH 4/4] rust: build the default set of tools Alexander Kanavin
2024-05-18 21:55 ` [OE-core] [PATCH 1/4] rust: correctly link rust-snapshot into build/stage0 Alexandre Belloni
2024-05-19 0:27 ` Alexander Kanavin
2024-05-19 0:28 ` Alexander Kanavin
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=20240516112111.2145436-3-alex.kanavin@gmail.com \
--to=alex.kanavin@gmail.com \
--cc=alex@linutronix.de \
--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