From patchwork Tue May 21 12:50:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kanavin X-Patchwork-Id: 43909 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FF2DC25B75 for ; Tue, 21 May 2024 12:50:55 +0000 (UTC) Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) by mx.groups.io with SMTP id smtpd.web11.18798.1716295848374976611 for ; Tue, 21 May 2024 05:50:48 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Mn0f8QtM; spf=pass (domain: gmail.com, ip: 209.85.167.45, mailfrom: alex.kanavin@gmail.com) Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-52388d9ca98so7398912e87.0 for ; Tue, 21 May 2024 05:50:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716295846; x=1716900646; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=2SmRgHmvopiNMlB0ESLKg+BaG2pXfO29SQwCiabAuGU=; b=Mn0f8QtMt4ML2d+9AQ1RPd0AgNBDS5fCyNFgCVLuvKIA+pVmXWGAUYHTSLraTijc9h 1a+JbDmfAr9CDx0xfwwdFuC194q2iHiXtWW0OZe8YH5qmAgBvvtfh2NN+zyqO0SKRXgR vasqPZpuutNauLNLOD+lO+uyD86sl2hrP8XId5I2gXFVcEJvXGkhTorH//njYsI1CsqT R9jY51zyMfqDXfMpQsNFyROspUsZuHcjXwigJtOsAfauhh4plR9T+3kQvicdPW0SAfP+ PTcU0mV/oK4OzRVWO5tNKH/klI3tdCDUVz4C8mayq2crVZIu9qT/Hm8hsyYFJjos1MYy 6ZzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716295846; x=1716900646; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=2SmRgHmvopiNMlB0ESLKg+BaG2pXfO29SQwCiabAuGU=; b=XXHjgfJTS1n989D7vh3t1m7Vw1YBdRPG8II1JjPeEn1hC0rYZVJCDjGbRU4+45NfSE 3xlV4EfsgJ1+ICPdRaLiTwIQ6Ak3k6qkvGnnzs6/68ba1PWf2ikBHy9ilfoyf8fPLfY8 /55ff7HXpNN85ZdXjOMrw4+m02DeZA0Is5Hlg/rZVvvEzZwxAKXF6DNoiAtbIItax+Hs GyK/yH6OainNRagxjbd95T99MxvR0vKjl1eOwJPVrDCT4nGQUTor7QcSbio1IIBORvfE lLj2hL/SoHcduA3ZcI4wde0Erco0mtXW6+f/DsyVTkizkwHj/cyvLZs7tRXechPMM9WP JWvQ== X-Gm-Message-State: AOJu0YzqD0YJweeT1DMcbdwSfLovi5d5eDmxPjGbRp/n+awTqhSm+Sn2 PW5bzWjHAzCUJT9Y1CaVmFWqDR7NpUv4w8ydCEjaJyxCgYd1nFzWcxavFg== X-Google-Smtp-Source: AGHT+IHDBiXw5RFaCJIpbjqJTvs0vdsmeCFg+Gnc8G8Wb4rIPHDWOTRwFzAr8SeKpsKynnPsJqyuWQ== X-Received: by 2002:a05:6512:2147:b0:523:b068:a6d4 with SMTP id 2adb3069b0e04-523b068a93dmr9938393e87.45.1716295846377; Tue, 21 May 2024 05:50:46 -0700 (PDT) Received: from Zen2.lab.linutronix.de. (drugstore.linutronix.de. [80.153.143.164]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a1781d294sm1595584166b.28.2024.05.21.05.50.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 05:50:46 -0700 (PDT) From: Alexander Kanavin To: openembedded-core@lists.openembedded.org Cc: Alexander Kanavin Subject: [PATCH v2 1/5] rust: correctly link rust-snapshot into build/stage0 Date: Tue, 21 May 2024 14:50:37 +0200 Message-Id: <20240521125041.3611820-1-alex.kanavin@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 21 May 2024 12:50:55 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/199632 From: Alexander Kanavin This does not seem to be used in regular builds, but is beneficial in rust selftest, where it allows dropping a custom patch that is unsuitable for upstream (and was rejected by them). Also remove an obsolete comment that seems related to the code but describes something that was resolved long time ago. I have confirmed that the rust selftest continues to pass with just this one commit on top of master (as the following changes do break the selftest). Signed-off-by: Alexander Kanavin --- .../rust/files/cargo-path.patch | 37 ------------------- meta/recipes-devtools/rust/rust-source.inc | 1 - meta/recipes-devtools/rust/rust_1.75.0.bb | 6 +-- 3 files changed, 2 insertions(+), 42 deletions(-) delete mode 100644 meta/recipes-devtools/rust/files/cargo-path.patch diff --git a/meta/recipes-devtools/rust/files/cargo-path.patch b/meta/recipes-devtools/rust/files/cargo-path.patch deleted file mode 100644 index 9a50c402201..00000000000 --- a/meta/recipes-devtools/rust/files/cargo-path.patch +++ /dev/null @@ -1,37 +0,0 @@ -Fix the cargo binary path error and ensure that it is fetched -during rustc bootstrap in rust oe-selftest. - -====================================================================== -ERROR: test_cargoflags (bootstrap_test.BuildBootstrap) ----------------------------------------------------------------------- -Traceback (most recent call last): - File "/home/build-st/tmp/work/cortexa57-poky-linux/rust/1.74.1/rustc-1.74.1-src/src/bootstrap/bootstrap_test.py", line 157, in test_cargoflags - args, _ = self.build_args(env={"CARGOFLAGS": "--timings"}) - File "/home/build-st/tmp/work/cortexa57-poky-linux/rust/1.74.1/rustc-1.74.1-src/src/bootstrap/bootstrap_test.py", line 154, in build_args - return build.build_bootstrap_cmd(env), env - File "/home/build-st/tmp/work/cortexa57-poky-linux/rust/1.74.1/rustc-1.74.1-src/src/bootstrap/bootstrap.py", line 960, in build_bootstrap_cmd - raise Exception("no cargo executable found at `{}`".format( -Exception: no cargo executable found at `/home/build-st/tmp/work/cortexa57-poky-linux/rust/1.74.1/rustc-1.74.1-src/build/x86_64-unknown-linux-gnu/stage0/bin/cargo` - -Upstream-Status: Submitted [https://github.com/rust-lang/rust/pull/120125] - -Signed-off-by: Yash Shinde ---- -diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py ---- a/src/bootstrap/bootstrap.py -+++ b/src/bootstrap/bootstrap.py -@@ -954,9 +954,11 @@ - if "RUSTFLAGS_BOOTSTRAP" in env: - env["RUSTFLAGS"] += " " + env["RUSTFLAGS_BOOTSTRAP"] - -- env["PATH"] = os.path.join(self.bin_root(), "bin") + \ -- os.pathsep + env["PATH"] -- if not os.path.isfile(self.cargo()): -+ cargo_bin_path = os.path.join(self.bin_root(), "bin", "cargo") -+ if not os.path.isfile(cargo_bin_path): -+ cargo_bin_path = os.getenv("RUST_TARGET_PATH") + "rust-snapshot/bin/cargo" -+ env["PATH"] = os.path.dirname(cargo_bin_path) + os.pathsep + env["PATH"] -+ else: - raise Exception("no cargo executable found at `{}`".format( - self.cargo())) - args = [self.cargo(), "build", "--manifest-path", diff --git a/meta/recipes-devtools/rust/rust-source.inc b/meta/recipes-devtools/rust/rust-source.inc index b14221b6cb8..c83c8ec3a39 100644 --- a/meta/recipes-devtools/rust/rust-source.inc +++ b/meta/recipes-devtools/rust/rust-source.inc @@ -7,7 +7,6 @@ SRC_URI += "https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz;n file://rv32-missing-syscalls.patch;patchdir=${RUSTSRC} \ file://rv32-rustix-libc-backend.patch;patchdir=${RUSTSRC} \ file://rv32-cargo-rustix-0.38.19-fix.patch;patchdir=${RUSTSRC} \ - file://cargo-path.patch;patchdir=${RUSTSRC} \ file://custom-target-cfg.patch;patchdir=${RUSTSRC} \ file://rustc-bootstrap.patch;patchdir=${RUSTSRC} \ file://target-build-value.patch;patchdir=${RUSTSRC} \ diff --git a/meta/recipes-devtools/rust/rust_1.75.0.bb b/meta/recipes-devtools/rust/rust_1.75.0.bb index 76e1fe2d84a..8ef838ee90c 100644 --- a/meta/recipes-devtools/rust/rust_1.75.0.bb +++ b/meta/recipes-devtools/rust/rust_1.75.0.bb @@ -35,8 +35,6 @@ RUST_ALTERNATE_EXE_PATH_NATIVE = "${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-co # own vendoring. CARGO_DISABLE_BITBAKE_VENDORING = "1" -# We can't use RUST_BUILD_SYS here because that may be "musl" if -# TCLIBC="musl". Snapshots are always -unknown-linux-gnu setup_cargo_environment () { # The first step is to build bootstrap and some early stage tools, # these are build for the same target as the snapshot, e.g. @@ -54,8 +52,8 @@ do_rust_setup_snapshot () { # Some versions of rust (e.g. 1.18.0) tries to find cargo in stage0/bin/cargo # and fail without it there. - mkdir -p ${RUSTSRC}/build/${BUILD_SYS} - ln -sf ${WORKDIR}/rust-snapshot/ ${RUSTSRC}/build/${BUILD_SYS}/stage0 + mkdir -p ${RUSTSRC}/build/${RUST_BUILD_SYS} + ln -sf ${WORKDIR}/rust-snapshot/ ${RUSTSRC}/build/${RUST_BUILD_SYS}/stage0 # Need to use uninative's loader if enabled/present since the library paths # are used internally by rust and result in symbol mismatches if we don't From patchwork Tue May 21 12:50:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kanavin X-Patchwork-Id: 43911 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 467D4C25B7D for ; Tue, 21 May 2024 12:50:55 +0000 (UTC) Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) by mx.groups.io with SMTP id smtpd.web11.18800.1716295848845465225 for ; Tue, 21 May 2024 05:50:49 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=W+Boa7gH; spf=pass (domain: gmail.com, ip: 209.85.218.44, mailfrom: alex.kanavin@gmail.com) Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a59a0e4b773so830779866b.2 for ; Tue, 21 May 2024 05:50:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716295847; x=1716900647; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JbEr+6Ejlt39m/d596jf0Dl4SzxFVtw4fyf0ljvkpwk=; b=W+Boa7gHovNTZUURL8L0P2Zix/pfrDaUfk2yYV8MIFgZp7QVh8oWxaGdqtquwgJBuf Z/6zqSqOEMygswCZqcvB2zzU2nn0OdvoXLBj3NziGo5uz+R2W2w/zTcLUAJhRehLSl8Y UdD6vCQ1in6PILTFpCQrpScuTM5iVJdS8ZpB4R+RiJD5zl+iqfNuZxMRKKv4XP+UV0Na sbCRqkdysbnfZX2zhteavwQ8dhVOiYYzRxGZOlnFsGlaVSxb7xaJlffa6RJM706UOZQB g9GtxgMMzS3yltuph5jVa6VglZjM3zgASBN7RT5Az7nystTLdfQX0hf6O+9tyXtTLttz 5UXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716295847; x=1716900647; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JbEr+6Ejlt39m/d596jf0Dl4SzxFVtw4fyf0ljvkpwk=; b=u4Xa/X5vo9b/1uTqzHW2SH1RSpIpDWoz6woAdE/19Q02JaBcLvV4bplflwLINQ+Nlu z6EcIaXyySOhIr22U2/ebLOlYktRARJMm3VpciobVQxaoAgPsLz8AxLSRweuR1/neiQu h2aRre9JEV2jru2EGDtwdd5JCAXJty3oy8wfiEeD7X7lhXe3KU7HnI7Ij3R0m/c8J1CW LQnwoNE8FhhXbY584fbjyvO1/uAikgyuDgUCtMXhMAK/JVgnxhLUVO190BT2kYjptTfr WGT2hIBOIumrc1pkIsgFEA+FKgfCM4aR5DuPdul4+bq3vWPtITft3/IoezbqHPCsUnbU yAEQ== X-Gm-Message-State: AOJu0Yx7HyUtzUAWRevNmfnZxaf/GDEMurvRuCi7LjdI0ukJKFSUq6VX hYJVl8RRnS+kUHR96As6dofboBrxcXs/7HpvToz79BAc39fL7NwicAXCDg== X-Google-Smtp-Source: AGHT+IGhkcguRI99grVJhTY4ouJr83RsN8IiA1uauUB3Q1qeFGi3kwEMwyrY47FpHdPpzz/+S3NBSA== X-Received: by 2002:a17:907:7daa:b0:a5a:4705:ad36 with SMTP id a640c23a62f3a-a5a4705b758mr2292228866b.16.1716295847040; Tue, 21 May 2024 05:50:47 -0700 (PDT) Received: from Zen2.lab.linutronix.de. (drugstore.linutronix.de. [80.153.143.164]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a1781d294sm1595584166b.28.2024.05.21.05.50.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 05:50:46 -0700 (PDT) From: Alexander Kanavin To: openembedded-core@lists.openembedded.org Cc: Alexander Kanavin Subject: [PATCH v2 2/5] rust: add reproducibility patch to eliminate host leakage Date: Tue, 21 May 2024 14:50:38 +0200 Message-Id: <20240521125041.3611820-2-alex.kanavin@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240521125041.3611820-1-alex.kanavin@gmail.com> References: <20240521125041.3611820-1-alex.kanavin@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 21 May 2024 12:50:55 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/199633 From: Alexander Kanavin [YOCTO #15185] Signed-off-by: Alexander Kanavin --- ...te-host-information-into-compilation.patch | 51 +++++++++++++++++++ meta/recipes-devtools/rust/rust-source.inc | 1 + 2 files changed, 52 insertions(+) create mode 100644 meta/recipes-devtools/rust/files/0001-cargo-do-not-write-host-information-into-compilation.patch diff --git a/meta/recipes-devtools/rust/files/0001-cargo-do-not-write-host-information-into-compilation.patch b/meta/recipes-devtools/rust/files/0001-cargo-do-not-write-host-information-into-compilation.patch new file mode 100644 index 00000000000..a6ee8676058 --- /dev/null +++ b/meta/recipes-devtools/rust/files/0001-cargo-do-not-write-host-information-into-compilation.patch @@ -0,0 +1,51 @@ +From 065d7c263091118437465d714d8a29dbb6296921 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin +Date: Mon, 13 May 2024 14:57:54 +0200 +Subject: [PATCH] cargo: do not write host information into compilation unit + hashes + +This breaks reproducibility in cross-builds where the cross-target +can be the same, but build hosts are different, as seen with +"rustc --version -v": +... +host: x86_64-unknown-linux-gnu + +vs. + +host: aarch64-unknown-linux-gnu + +This can possibly be improved by only hashing host info if the build +is a native one (e.g. there's no --target option passed to cargo +invocation) but I'm not sure how. + +Upstream-Status: Inappropriate [reported at https://github.com/rust-lang/cargo/issues/13922] +Signed-off-by: Alexander Kanavin +--- + .../src/cargo/core/compiler/context/compilation_files.rs | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/tools/cargo/src/cargo/core/compiler/context/compilation_files.rs b/src/tools/cargo/src/cargo/core/compiler/context/compilation_files.rs +index d83dbf10c..b2ad8d9f3 100644 +--- a/src/tools/cargo/src/cargo/core/compiler/context/compilation_files.rs ++++ b/src/tools/cargo/src/cargo/core/compiler/context/compilation_files.rs +@@ -652,7 +652,7 @@ fn hash_rustc_version(bcx: &BuildContext<'_, '_>, hasher: &mut StableHasher) { + if vers.pre.is_empty() || bcx.config.cli_unstable().separate_nightlies { + // For stable, keep the artifacts separate. This helps if someone is + // testing multiple versions, to avoid recompiles. +- bcx.rustc().verbose_version.hash(hasher); ++ //bcx.rustc().verbose_version.hash(hasher); + return; + } + // On "nightly"/"beta"/"dev"/etc, keep each "channel" separate. Don't hash +@@ -665,7 +665,7 @@ fn hash_rustc_version(bcx: &BuildContext<'_, '_>, hasher: &mut StableHasher) { + // Keep "host" since some people switch hosts to implicitly change + // targets, (like gnu vs musl or gnu vs msvc). In the future, we may want + // to consider hashing `unit.kind.short_name()` instead. +- bcx.rustc().host.hash(hasher); ++ //bcx.rustc().host.hash(hasher); + // None of the other lines are important. Currently they are: + // binary: rustc <-- or "rustdoc" + // commit-hash: 38114ff16e7856f98b2b4be7ab4cd29b38bed59a +-- +2.39.2 + diff --git a/meta/recipes-devtools/rust/rust-source.inc b/meta/recipes-devtools/rust/rust-source.inc index c83c8ec3a39..20ef5e82bc4 100644 --- a/meta/recipes-devtools/rust/rust-source.inc +++ b/meta/recipes-devtools/rust/rust-source.inc @@ -12,6 +12,7 @@ SRC_URI += "https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz;n file://target-build-value.patch;patchdir=${RUSTSRC} \ file://0001-Handle-vendored-sources-when-remapping-paths.patch;patchdir=${RUSTSRC} \ file://repro-issue-fix-with-v175.patch;patchdir=${RUSTSRC} \ + file://0001-cargo-do-not-write-host-information-into-compilation.patch;patchdir=${RUSTSRC} \ " SRC_URI[rust.sha256sum] = "4526f786d673e4859ff2afa0bab2ba13c918b796519a25c1acce06dba9542340" From patchwork Tue May 21 12:50:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kanavin X-Patchwork-Id: 43908 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D121C41513 for ; Tue, 21 May 2024 12:50:55 +0000 (UTC) Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) by mx.groups.io with SMTP id smtpd.web11.18801.1716295849509947103 for ; Tue, 21 May 2024 05:50:49 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Kbfg83w4; spf=pass (domain: gmail.com, ip: 209.85.218.41, mailfrom: alex.kanavin@gmail.com) Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a59b49162aeso827173466b.3 for ; Tue, 21 May 2024 05:50:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716295848; x=1716900648; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jPNcM1xdWejvI+BC1btAiA9YQq7o6vAKPdbz5T/xGJw=; b=Kbfg83w4vpVRIbN+B/7hfLuoZ4t3HZdQlgxt4aHArJ0ch2s8HWNhWwL0OvcHg5Q1j4 BJ+WW3Z6cLrblA+EHhOGDSbnbNhKnd1+ceR/tHN/2KxLn++q8a8qOiC1z6t7de/Yvjei gmf5j0uZlaKqdbJ76Dr3PaAIVnFyqeeRjwYn6colxdl8bTa/xjUDt0GwEbGGHZJ++YN0 WPcI9W+awdV1o1dj8/IpbWaY6eZ4RvaPxhgHeqFc2rirKzO4BtvOcxuqYErYtm3CdYOn FDHM89xnPtZ9N2WxgVnb++f83Mvn7yeFVhR05UxcOODEMEH5nNVRrfVlAA7vZw22tD7u kfkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716295848; x=1716900648; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jPNcM1xdWejvI+BC1btAiA9YQq7o6vAKPdbz5T/xGJw=; b=rcS/31YCX0Djg3UzdCVLwHuTfTawTs6WxgchASsVs2e7r1EYamQJAVnX1o5U1f8St2 MyjSb3TDJLH6pJG2SHPBKlL+Z6wuYsFOmlNdb+mLqq4LIiClxIxt8OzLiUFRA+8D7hmX 7T1UCqTTKhjw812wO5ex0wL6U7jL4f7qwUGYywnqIL39tAKB1AN6uKy/4rvMa8KClHHk KezvvkL/704f/haT4kc+PW5LEuDqsok5SvbZ+RfMcRW3g9BqbfrTqbk3Rd0k8Muvhg0o KwE4znbR8olJykKIKBCB1T9z8v9HXBFY/h0vgaamzBrmI7d3lzCQYu1Uqm0oc7bOo1Cy UBKA== X-Gm-Message-State: AOJu0Yzj6VZTjmxgyZhXb2f6wXPFOhc+kzgdZrox7VYnUbcWtHUUd1r/ R4oknS9yGsvS0Wb3VNJmiFHdhVDGX8ZdeZYKG1QV3ZNLg5We3eOMMOlymg== X-Google-Smtp-Source: AGHT+IFSTErMR5DQmr9I3vbmR65hlcVudh8D3ApYXpTXs4Ruyay0Oh7M/htAKtVVvdjvqyhTRTgUxg== X-Received: by 2002:a17:906:305a:b0:a59:db0f:6be4 with SMTP id a640c23a62f3a-a5a2d534ec4mr2049361166b.5.1716295847626; Tue, 21 May 2024 05:50:47 -0700 (PDT) Received: from Zen2.lab.linutronix.de. (drugstore.linutronix.de. [80.153.143.164]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a1781d294sm1595584166b.28.2024.05.21.05.50.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 05:50:47 -0700 (PDT) From: Alexander Kanavin To: openembedded-core@lists.openembedded.org Cc: Alexander Kanavin Subject: [PATCH v2 3/5] rust: use rust-snapshot binaries only in rust-native Date: Tue, 21 May 2024 14:50:39 +0200 Message-Id: <20240521125041.3611820-3-alex.kanavin@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240521125041.3611820-1-alex.kanavin@gmail.com> References: <20240521125041.3611820-1-alex.kanavin@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 21 May 2024 12:50:55 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/199634 From: Alexander Kanavin 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 --- 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)) From patchwork Tue May 21 12:50:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kanavin X-Patchwork-Id: 43910 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A5E1C25B74 for ; Tue, 21 May 2024 12:50:55 +0000 (UTC) Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) by mx.groups.io with SMTP id smtpd.web10.18810.1716295849718138283 for ; Tue, 21 May 2024 05:50:50 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=fH0KuT66; spf=pass (domain: gmail.com, ip: 209.85.218.44, mailfrom: alex.kanavin@gmail.com) Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a5dcb5a0db4so364757066b.2 for ; Tue, 21 May 2024 05:50:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716295848; x=1716900648; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5nQ099l2BvVtCkH+RmCDlly10F27wE3g4deWEqlmZB4=; b=fH0KuT66pUoV0OtZwiLU6yfKXIwZfKOV6QtMFco1k7D+mrUFv3se0i/V5WQq3sDMuV PbYFDDTn4xFEtDY1Sjp7YKcR2as3NO5JjMAq2VeRdPgzt51GBZGl37h4vBHmrpmuU9Sy 02bNc0Kd/3u7zO3ebujfjhBjmu/12eVArLClgw7d9k7oK2wtAUJAGzmZeG04rmPA8U4G fVKkT3I6ZsMEIJZaq/bEwvuE4G8LA0LQoORn4qp/wU3X0XlL3VpEtPJ4nfRm2T+6JRi0 AYq4VIHThVCiqzWZX82iw1liD5f8S3f/yYBg0KLaclLYq0ULYb/b3Ib/d2zPtnqzJBSS EqsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716295848; x=1716900648; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5nQ099l2BvVtCkH+RmCDlly10F27wE3g4deWEqlmZB4=; b=HJzoUI7+FqDpX2yiau2AAqF9y2zM8rYJtDaONa7Ed5RTlrsaZH15Ey2nTs0HgigBPX ceFgZUzD/lPV8zRvBqQ/VL+Wx3uD+9y02NS1c4Jrcuse7nTEKknCElSWSA6xe2TpCyQb 3e/Gms625fDVVxxsdjq5CQCwc112bOg/37YYe3kXnMGbA2jbRgTOjiIRmPyG30sUJRGO SHGlfabFZeTTvz4CwimJGGPGrZTND00S0e5ghdmaGQVd0jWHU41ebbObkj4LqDsodiz0 gZrnQB0lbOUtIGGDjdaI3qaqPV2jUfUFbEQ+rp8r+xHSZbn9PYeIZGxeXOvz6ASqzWB1 RYcw== X-Gm-Message-State: AOJu0Yy4egyhvdJakxr0asE/ZC0o/seALpFGYdv1Xu6RhMePB/RE+hBo Z1WEk1o+Zvr10awE9w4ejbEFrov5+djRMU+VGHsOJKMDMWF7f37/KKKb2A== X-Google-Smtp-Source: AGHT+IGrtCPGZwMcDPjYSdAbcsEoE7I/TGTsBBwp18/mW4DLK7YvQOl/uZPfIe1XDYU3Ybg5bRqGIQ== X-Received: by 2002:a17:906:138f:b0:a59:afbc:1b0 with SMTP id a640c23a62f3a-a5a2d676041mr2025102466b.64.1716295848176; Tue, 21 May 2024 05:50:48 -0700 (PDT) Received: from Zen2.lab.linutronix.de. (drugstore.linutronix.de. [80.153.143.164]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a1781d294sm1595584166b.28.2024.05.21.05.50.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 05:50:47 -0700 (PDT) From: Alexander Kanavin To: openembedded-core@lists.openembedded.org Cc: Alexander Kanavin Subject: [PATCH v2 4/5] rust: build the default set of tools Date: Tue, 21 May 2024 14:50:40 +0200 Message-Id: <20240521125041.3611820-4-alex.kanavin@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240521125041.3611820-1-alex.kanavin@gmail.com> References: <20240521125041.3611820-1-alex.kanavin@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 21 May 2024 12:50:55 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/199635 From: Alexander Kanavin Setting it explicitly replaces rust's default choice which is rustdoc (needed for example in selftests and otherwise expected to be present in typical rust installations): https://github.com/rust-lang/rust/blob/master/config.example.toml#L320 This addresses some of the rust selftest failures but not all. Help is appreciate to restore the selftest. Unfortunately, this also breaks rust reproducibility (or rather exposes that it was never properly fixed, as explained here: https://lists.openembedded.org/g/openembedded-core/message/199288 ) Signed-off-by: Alexander Kanavin --- meta/lib/oeqa/selftest/cases/reproducible.py | 2 ++ meta/recipes-devtools/rust/rust_1.75.0.bb | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/meta/lib/oeqa/selftest/cases/reproducible.py b/meta/lib/oeqa/selftest/cases/reproducible.py index 80e830136f7..97a9c3da908 100644 --- a/meta/lib/oeqa/selftest/cases/reproducible.py +++ b/meta/lib/oeqa/selftest/cases/reproducible.py @@ -16,6 +16,8 @@ import os import datetime exclude_packages = [ + 'rust-rustdoc', + 'rust-dbg' ] def is_excluded(package): diff --git a/meta/recipes-devtools/rust/rust_1.75.0.bb b/meta/recipes-devtools/rust/rust_1.75.0.bb index e82a7395e44..b041a5f8e4c 100644 --- a/meta/recipes-devtools/rust/rust_1.75.0.bb +++ b/meta/recipes-devtools/rust/rust_1.75.0.bb @@ -149,7 +149,6 @@ python do_configure() { config.add_section("build") config.set("build", "submodules", e(False)) config.set("build", "docs", e(False)) - config.set("build", "tools", ["rust-demangler",]) rustc = d.getVar('RUSTC_BOOTSTRAP') config.set("build", "rustc", e(rustc)) From patchwork Tue May 21 12:50:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kanavin X-Patchwork-Id: 43912 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45B4CC25B7A for ; Tue, 21 May 2024 12:50:55 +0000 (UTC) Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) by mx.groups.io with SMTP id smtpd.web11.18802.1716295850484351713 for ; Tue, 21 May 2024 05:50:50 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=JWZMhoGi; spf=pass (domain: gmail.com, ip: 209.85.218.46, mailfrom: alex.kanavin@gmail.com) Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-a5a5c930cf6so858355566b.0 for ; Tue, 21 May 2024 05:50:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716295849; x=1716900649; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kDeRDH3BNgDINckt8pMwz02gLXShgQkUFfOys5ubdww=; b=JWZMhoGieiEkGA3GO0iXgo32FzxLSqvYcsMieGS+Sz32JqUU+0qsqzEBj24/Te8hEs H2mdEdWtgWwMMBEogSMNZoqO9wRsnidUUmwpRklGjrnKV5LIHN+ysR6LXJfVcW6AuG2Y QW2i8Q6WvCDYxUQ6tzw7WopJSKhd6fH2SVzUswplmFWSIY9xac4QwoOOH8Ct0C0nSYvT zSuUmDHOAdvdqR1EFG3cqAN2QN2ijnKf1HLuTLfNHHBmYxhuX2Ix8ultAFsXpyEk4fBM BwN24933jil30xEEoQuSFACWsP4ug6AyN4o3U3lCuRR4mf07OHPd2Yy9gyNQ1od0HvfB SduQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716295849; x=1716900649; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kDeRDH3BNgDINckt8pMwz02gLXShgQkUFfOys5ubdww=; b=uJcVCNk3OSVhtC+R62jk1grOLlQ9xu9onYLJXla30GFAuxGyK5DR2jUT/m0zdTckLR 8LouhvePF74WkklQzex1pETPV4HAlwB7w1X3JXH6I/Syq8fVxTNKXJ/hvJV0bALpzj4w rX/6+8/5oAQnmHoCdNWrHo1JTBd12vi1QTcHrXdlHgZeMqlKsN4WhHyeBdOCxkYnTxrK RLw2qxq1IpdFkDVATP8BeuN/BGukhluma+mVt6mC8uTGuuLZx72xeJ/bdU7bHFqR+Vbw TDya2zaM3nEWMh1rS+W/P7OqgIg+wlwbj0UqtbE/Un+pMldUFE+k7tX3fxac5e3SjLHc oDmg== X-Gm-Message-State: AOJu0YwcDh+8PomIE7C0Vna85AkZ6gRr/zMEFa5jnCsEzNpRAR07jFqa My4NG59KvzCEy/TWuTR6w1wqc9xnAsquQIGSLwvDe/TZRSNP3gL9jNYLDQ== X-Google-Smtp-Source: AGHT+IFVDpZEEZrCaVKRkbHx4YRO0dj8t9LhqD2SbaBbPBOKUzOcxcUqiLQskIPlUpHvatd6oVfKTQ== X-Received: by 2002:a17:906:9e06:b0:a62:1b4f:6018 with SMTP id a640c23a62f3a-a621b4f60fcmr14733466b.54.1716295848678; Tue, 21 May 2024 05:50:48 -0700 (PDT) Received: from Zen2.lab.linutronix.de. (drugstore.linutronix.de. [80.153.143.164]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a1781d294sm1595584166b.28.2024.05.21.05.50.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 05:50:48 -0700 (PDT) From: Alexander Kanavin To: openembedded-core@lists.openembedded.org Cc: Alexander Kanavin Subject: [PATCH v2 5/5] selftest/rust: correctly form the PATH environment variable Date: Tue, 21 May 2024 14:50:41 +0200 Message-Id: <20240521125041.3611820-5-alex.kanavin@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240521125041.3611820-1-alex.kanavin@gmail.com> References: <20240521125041.3611820-1-alex.kanavin@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 21 May 2024 12:50:55 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/199636 From: Alexander Kanavin There were two issues here: - the path to native python was not included, so the test suite was running with host python, causing failures due to host python being given native libraries: https://autobuilder.yoctoproject.org/typhoon/#/builders/148/builds/1711/steps/12/logs/stdio (rust recipe uses native python throughout) - tmp/hosttools was listead ahead of native-sysroot/usr/bin Signed-off-by: Alexander Kanavin --- meta/lib/oeqa/selftest/cases/rust.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/meta/lib/oeqa/selftest/cases/rust.py b/meta/lib/oeqa/selftest/cases/rust.py index ad14189c6df..4ccbe9867b5 100644 --- a/meta/lib/oeqa/selftest/cases/rust.py +++ b/meta/lib/oeqa/selftest/cases/rust.py @@ -210,9 +210,8 @@ class RustSelfTestSystemEmulated(OESelftestTestCase, OEPTestResultTestCase): tmpdir = get_bb_var("TMPDIR", "rust") # Set path for target-poky-linux-gcc, RUST_TARGET_PATH and hosttools. - cmd = " export PATH=%s/recipe-sysroot-native/usr/bin:$PATH;" % rustlibpath - cmd = cmd + " export TARGET_VENDOR=\"-poky\";" - cmd = cmd + " export PATH=%s/recipe-sysroot-native/usr/bin/%s:%s/hosttools:$PATH;" % (rustlibpath, tcpath, tmpdir) + cmd = "export TARGET_VENDOR=\"-poky\";" + 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 # Trigger testing. cmd = cmd + " export TEST_DEVICE_ADDR=\"%s:12345\";" % qemu.ip