From patchwork Thu May 16 11:21:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kanavin X-Patchwork-Id: 43757 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 90591C25B78 for ; Thu, 16 May 2024 11:21:17 +0000 (UTC) Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) by mx.groups.io with SMTP id smtpd.web10.10987.1715858475996745622 for ; Thu, 16 May 2024 04:21:16 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=X08Ukxbs; spf=pass (domain: gmail.com, ip: 209.85.218.42, mailfrom: alex.kanavin@gmail.com) Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-a59b81d087aso268051166b.3 for ; Thu, 16 May 2024 04:21:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715858474; x=1716463274; 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=X08UkxbsP6EJ8A7xhd2CTcZ1MZc6j4ux13vb9J5/877NRwGmR5OI4iwi7LHnmpvbLD YlzPljitxOY48dUeZLSGyREOOWUvmUvcMSRnAF2ILXYWlqGigVxv+7a76/lYem6LW6Bq 58qfwwwn9tM7xZ8dsneC3osV2tH7eTTypEK4IizFZGHeGUkyKv3X0ZCp0waXuV7BkZIL IotoLWvdlb8n64qvV0BmYzimO6V+kHguMgAdU7k2FoHLIT4SUoqCSH/SnTsI44gG3ouw z4qXKvNTu6UrRiwEv5g5KW1JittqUwWQm1cz3My9KsEN6275+xFux66lByLgL4UmU6y+ ClJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715858474; x=1716463274; 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=VVjfJ/ODde2xcWmIf1rOCFHYdEJyJDg+hNxktkFCEKWF6C+B2keEPteXTkQSZyHm2K eNNtdjIYxWXKqQSJOHB1z7coBxMb4wHN2gq+s3Vj8KOGMTcoFCbkgO1m/LFdiFlUz3TL oQMJyMyc0Q4xgXM6u2bXcR1w0hSImlBN4H/rKvCmrOF0+WlJ1eW81Ncd9NgN0aTy6us7 DhnzBQJm84hSOwJmBsotld6VudoEz+JcIx7D8lZ308mwvpif5chPig2gp6ZV/EvtD5rf m0s0iTh7JOg36JmAWaVouBp/vivJl4nb4r4CAYoK79Hp8f/ycedoH9NO9OssZ1kBlwiE Z9yQ== X-Gm-Message-State: AOJu0Ywkyd2ETdB0q6lYP7lHdHmmeQfgEsoxHOff20w4xiZ84rcy8Imu bwc++7u74h6dr6CDzcoIcn9HWXjOkgGJmIQaXfINHigyF+CFh2ukHuegdA== X-Google-Smtp-Source: AGHT+IEcD/UBcGVCxtNm1p0DICnhWo8PmsIuPS54yq7V6TN2eYmCkvzSg0kKovn65uVJEMt7U2pA5A== X-Received: by 2002:a17:906:ee81:b0:a59:b1cf:fea0 with SMTP id a640c23a62f3a-a5a2d55eef4mr2334433166b.19.1715858474139; Thu, 16 May 2024 04:21:14 -0700 (PDT) Received: from Zen2.lab.linutronix.de. (drugstore.linutronix.de. [80.153.143.164]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5cdcd149c5sm131254866b.201.2024.05.16.04.21.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 04:21:13 -0700 (PDT) From: Alexander Kanavin To: openembedded-core@lists.openembedded.org Cc: Alexander Kanavin Subject: [PATCH 1/4] rust: correctly link rust-snapshot into build/stage0 Date: Thu, 16 May 2024 13:21:08 +0200 Message-Id: <20240516112111.2145436-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 ; Thu, 16 May 2024 11:21:17 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/199464 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 Thu May 16 11:21:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kanavin X-Patchwork-Id: 43759 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 37B47C25B79 for ; Thu, 16 May 2024 11:21:27 +0000 (UTC) Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) by mx.groups.io with SMTP id smtpd.web10.10989.1715858477352812765 for ; Thu, 16 May 2024 04:21:17 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=b0VnyGDl; spf=pass (domain: gmail.com, ip: 209.85.218.42, mailfrom: alex.kanavin@gmail.com) Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-a5a89787ea4so290094366b.2 for ; Thu, 16 May 2024 04:21:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715858475; x=1716463275; 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=b0VnyGDlV+4v982+ulYySy0Ax8caTrLoyRox1h8mURgjLTA2hPVOuw0alTzyF9Pefc eidema9zL2Z97FrUoKwRtc/a9I/rf1KjTpZouwbTiS4jfhZsEgocz7Jd2OdziHN5bUWW 7Ow7UURkcuk2CI/kuSWTiyRNhTmlZpKO0Gzp2pitnig5qpxIFYJ9sD4lYNav7vJX4hLh 6wASvvm8iZ7pe8OVFzBCNFuclUcGt2nh61X2xa6QQzqNTmf+X11CXyApG5cOnvtLqEa8 hqYNtHdi0zo/JogPazhUDhHEc8GJzi5HiQX4EBkkUO/gK2kUYevBO7TGnnIgUeyjjSo1 CxkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715858475; x=1716463275; 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=JPhanIFcf/SzlJ5+kcO6qmb4CfAbcBeEzrSMZkOhN7sZ2i483DUkfKRVC+KLI2IbZ1 FGMIjAlird5bXnvu0EJID57D+ze8z/H4w+dYeyVKEm+BV4RjPJZbWzoJstNtG95YDsJl PLk8lfFnciVa3eiC+LaHPasfcp+kKh3OmNRhrLuSihT4w+3ikK1EBVhPDEsJy8eRxvw8 ZLSDK/lqYWA6MeU5zylBE7gQg41u93OIgouLfKdxeOMbE68ru5MuNFh14Vo7rAuTM6QB /gA7iOKaT34zWY9+vypxI1k4I9t75OwPKT9uJzM2MEAPLw0o5WJmTeCaL8z1KWB1bslY o3GA== X-Gm-Message-State: AOJu0YzhxuYbUm1slvQPt7DJd7yaJXvwO4/N9U/sRRPhosT14i5nfRKq s6DXkEqpBTNnycYGVPdeyl9qmjwOOT2ZJqmhOTpNv223JMF/w/gnvK1MAg== X-Google-Smtp-Source: AGHT+IEpZHpAGqUZ6Ufuytt5zycDMla/cLW6CD59mJIY6KISDJO/nK5yw5eCIb3s3Lgq0qu+JAeAPA== X-Received: by 2002:a17:906:4ecb:b0:a59:c0a6:25d3 with SMTP id a640c23a62f3a-a5a2d54c102mr1220397066b.12.1715858474747; Thu, 16 May 2024 04:21:14 -0700 (PDT) Received: from Zen2.lab.linutronix.de. (drugstore.linutronix.de. [80.153.143.164]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5cdcd149c5sm131254866b.201.2024.05.16.04.21.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 04:21:14 -0700 (PDT) From: Alexander Kanavin To: openembedded-core@lists.openembedded.org Cc: Alexander Kanavin Subject: [PATCH 2/4] rust: add reproducibility patch to eliminate host leakage Date: Thu, 16 May 2024 13:21:09 +0200 Message-Id: <20240516112111.2145436-2-alex.kanavin@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240516112111.2145436-1-alex.kanavin@gmail.com> References: <20240516112111.2145436-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 ; Thu, 16 May 2024 11:21:27 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/199466 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 Thu May 16 11:21:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kanavin X-Patchwork-Id: 43758 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 35C7DC25B74 for ; Thu, 16 May 2024 11:21:27 +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.web10.10988.1715858477146447985 for ; Thu, 16 May 2024 04:21:17 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=MU1vI3dH; 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-a59e4136010so318639966b.3 for ; Thu, 16 May 2024 04:21:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715858475; x=1716463275; 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=MU1vI3dH5tjli0Bvnucw27r1+lHWa67tv7fpYCNTjJPx5wmJCdgLr2fW4MTMMD2l/3 Zkw5IGm6OmsaZW4A11oVI9nYHvsxSjSIbHfWvQhOE5wF4gDkGadeFqQfOBwV7EbNPdPs o/VGOzWZ2i6l+lBzFhmROFq1cPvYFEuR7S4r0I1BJoUgp5towmONsW7DWuaToLbWDoWb AKiPT7elsfZdDhCdORyuGuJ3VqV2hk5MXKPDecuPgBvtHXjikyGbAIx87To+FFab7y5s 4MTrj5W4J+w8xBNFgYs3njGz8QbsbcgXeUwjFkNr825Glx++eB4KzFfiD+dd+f7z0sKf ArNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715858475; x=1716463275; 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=IATDw8vdAtcSmGCOd9GtZURWG5JgEHweIwcPFnEwHJfOZtmyhjB19ZJ1HSqwbQSxru 5Y4inaykgBoDWYtiJkdZmqpznm8Eyj52maRv6dOdqRmKuSLpb9FefKjfujxDjPyehDM7 I3UGvGl9DOPcEDbnqo2cKrl2X1NMgivrp/0m3KB3txXagUQb4MAlia6eAczwhid2gFPE IiPlTHoBVT2gTJu8dw23qq2nvpFO19ft5GjxH547iwrioI7BWwYcfYcrMmprf5bBJbFm 7vy8oNAd9jN/pNFd+drWuoR31X/CDibVeUiKqF13nEGYlf4oirA8KyeF1MlfDTn6RNjp ZO3w== X-Gm-Message-State: AOJu0Ywm1EdAYK5inSGGjtbJk6G7QSo+cQbkblsJmrTY5i5j4hwsmROP OjHxK78YGJHWkoukSalYurr3SkIV18j+O9Jx/8wuM+dxVOoII47i7D0n+w== X-Google-Smtp-Source: AGHT+IEWhGkGTEmNChySV268fB0WyDS6tYl0YWwvkXHYSwRevhPLUEjyODHEjmw9TymEd34Rf/6mAg== X-Received: by 2002:a17:906:78b:b0:a59:ba2b:590e with SMTP id a640c23a62f3a-a5a2d65f27dmr1148967666b.48.1715858475402; Thu, 16 May 2024 04:21:15 -0700 (PDT) Received: from Zen2.lab.linutronix.de. (drugstore.linutronix.de. [80.153.143.164]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5cdcd149c5sm131254866b.201.2024.05.16.04.21.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 04:21:15 -0700 (PDT) From: Alexander Kanavin To: openembedded-core@lists.openembedded.org Cc: Alexander Kanavin Subject: [PATCH 3/4] rust: use rust-snapshot binaries only in rust-native Date: Thu, 16 May 2024 13:21:10 +0200 Message-Id: <20240516112111.2145436-3-alex.kanavin@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240516112111.2145436-1-alex.kanavin@gmail.com> References: <20240516112111.2145436-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 ; Thu, 16 May 2024 11:21:27 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/199465 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 Thu May 16 11:21:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kanavin X-Patchwork-Id: 43760 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 89AE4C25B78 for ; Thu, 16 May 2024 11:21:27 +0000 (UTC) Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) by mx.groups.io with SMTP id smtpd.web10.10990.1715858477668031718 for ; Thu, 16 May 2024 04:21:17 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=E+EtG+rE; spf=pass (domain: gmail.com, ip: 209.85.218.48, mailfrom: alex.kanavin@gmail.com) Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-a59b097b202so237628566b.0 for ; Thu, 16 May 2024 04:21:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715858476; x=1716463276; 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=E+EtG+rERspjK/PEPzBAs3gOy0jouR6hCCHe7147JZAxqOLh3aZCNOw6Ju3a9yh821 UJBaZdry4yk1wuxNQSZn3XGFYuojUol/BVR+bN2CDGtwVtSQU1JuRxpD8I2aMkESJ62A OPKvdW0ikBAmEi1LGDQ4gOvGyL/E3XDl8XlkwL9ODvk8m9WF4l91okxwEzz0sA5E72Ew mvX4N1p9cqVU513DHhaNYGJnNguSkxP4Rhj7qYK+asWINYSde/sFKivH1fm5E/NXZerR mPkf5qk0SLzChe+miJz19rlJu26+BeJsOIVQS4JcWCwmyVWjPSFgQ3bYOKFjZtYjoqlt K5AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715858476; x=1716463276; 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=rTIZfro6SpOlMv5VOzw10+zPmXb7B4wR5NNaPfo3uf8NNtLshVfaZ4ig0j+zESr/Rz m3IgE7/Tv4BZhzo4V5oV7J7nhYFWS/NNSz49+RXPewfuqYyAwzvUI+TvjPMTpJ35dsZa zwihcPi3CGQ9orCRT2FnZXjHPZ8+DhYkprUmdonsyDwpnl1uZHwR+Ukj6AuX0cjkPCB2 DEbEWJbOTEI/4bcb2Fjbk2pa7Z5SyE/t6P6CjH6EQDj1lLkhO5d5XC+05TrIdKXCFZ1D B93gkry5RA+KI7N6lpKfIf+uB4SWHvLPDmkyiiP7yw1G+QKSuglQeVWKQOEck8cUDN/M +zVA== X-Gm-Message-State: AOJu0YxO6zJIeS0E3D+fwHb0FZUU+aAJoa5QjVoSq4FTNct/fbVzQig/ xeLipVCqTdIeTVuNLwa2njEp76NkoitlHGuuHpmTg311u8FkayZjrmp3MQ== X-Google-Smtp-Source: AGHT+IEslAkzgQ/rKuKM/Fo4xwW+CkoFgQbJBrDSfz9OLwzeqXTRycGeaxaYbRmgfu41e2gKO6h0Gw== X-Received: by 2002:a17:907:3ac4:b0:a5c:dd34:25ec with SMTP id a640c23a62f3a-a5cdd342677mr186690966b.4.1715858476104; Thu, 16 May 2024 04:21:16 -0700 (PDT) Received: from Zen2.lab.linutronix.de. (drugstore.linutronix.de. [80.153.143.164]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5cdcd149c5sm131254866b.201.2024.05.16.04.21.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 04:21:15 -0700 (PDT) From: Alexander Kanavin To: openembedded-core@lists.openembedded.org Cc: Alexander Kanavin Subject: [PATCH 4/4] rust: build the default set of tools Date: Thu, 16 May 2024 13:21:11 +0200 Message-Id: <20240516112111.2145436-4-alex.kanavin@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240516112111.2145436-1-alex.kanavin@gmail.com> References: <20240516112111.2145436-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 ; Thu, 16 May 2024 11:21:27 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/199467 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))