From b0d30dbebf23b44399e5f75a2a786c4fd66293eb Mon Sep 17 00:00:00 2001 From: edouardparis Date: Fri, 21 Jun 2024 11:46:45 +0200 Subject: [PATCH] Use rustc 1.70 required by gui for docker reproducible build --- contrib/reproducible/docker/macos.Dockerfile | 18 +++++++++--------- contrib/reproducible/docker/macos_cmd.sh | 2 +- contrib/reproducible/docker/windows.Dockerfile | 18 +++++++++--------- contrib/reproducible/docker/windows_cmd.sh | 2 +- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/contrib/reproducible/docker/macos.Dockerfile b/contrib/reproducible/docker/macos.Dockerfile index ffa29ee6..ead987db 100644 --- a/contrib/reproducible/docker/macos.Dockerfile +++ b/contrib/reproducible/docker/macos.Dockerfile @@ -24,26 +24,26 @@ RUN apt update && apt satisfy -y \ "curl (>=7.74, <=7.74)" # Download the cargo binary and compiled stdlib from the distributed releases to make sure to build with -# the very same toolchain. We use 1.65.0 because it is unfortunately the MSRV of the GUI. -RUN curl -O "https://static.rust-lang.org/dist/rust-1.65.0-x86_64-unknown-linux-gnu.tar.gz" && \ - echo "8f754fdd5af783fe9020978c64e414cb45f3ad0a6f44d045219bbf2210ca3cb9 rust-1.65.0-x86_64-unknown-linux-gnu.tar.gz" | sha256sum -c && \ - tar -xzf rust-1.65.0-x86_64-unknown-linux-gnu.tar.gz && \ - curl -O "https://static.rust-lang.org/dist/rust-1.65.0-x86_64-apple-darwin.tar.gz" && \ - echo "139087a3937799415fd829e5a88162a69a32c23725a44457f9c96b98e4d64a7c rust-1.65.0-x86_64-apple-darwin.tar.gz" | sha256sum -c && \ - tar -xzf rust-1.65.0-x86_64-apple-darwin.tar.gz && \ +# the very same toolchain. We use 1.70.0 because it is unfortunately the MSRV of the GUI. +RUN curl -O "https://static.rust-lang.org/dist/rust-1.70.0-x86_64-unknown-linux-gnu.tar.gz" && \ + echo "8499c0b034dd881cd9a880c44021632422a28dc23d7a81ca0a97b04652245982 rust-1.70.0-x86_64-unknown-linux-gnu.tar.gz" | sha256sum -c && \ + tar -xzf rust-1.70.0-x86_64-unknown-linux-gnu.tar.gz && \ + curl -O "https://static.rust-lang.org/dist/rust-1.70.0-x86_64-apple-darwin.tar.gz" && \ + echo "e5819fdbfc7f1a4d5d82cb4c3b7662250748450b45a585433bfb75648bc45547 rust-1.70.0-x86_64-apple-darwin.tar.gz" | sha256sum -c && \ + tar -xzf rust-1.70.0-x86_64-apple-darwin.tar.gz && \ rm -r *.tar.gz # NOTE: we were previously caching dependencies here (through `cargo vendor`). It's a tradeoff between the image size # and not needing internet access when running the image to build the software. # For some reason, we can't just set the RUSTFLAGS environment variable to add `-L` for compiling dependencies. -# This doesn't work: RUSTFLAGS="-L/liana/rust-1.65.0-x86_64-apple-darwin/rust-std-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/" +# This doesn't work: RUSTFLAGS="-L/liana/rust-1.70.0-x86_64-apple-darwin/rust-std-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/" # As a workaround, we use a wrapped `rustc` binary that always links against the macOS stdlib we just downloaded. # Some issues that seem to be related: # https://github.com/rust-lang/rust/issues/40717 # https://github.com/rust-lang/rust/issues/48409 RUN echo "#!/bin/sh" > rustc_wrapper.sh && \ - echo "/liana/rust-1.65.0-x86_64-unknown-linux-gnu/rustc/bin/rustc \"\$@\" -L/liana/rust-1.65.0-x86_64-apple-darwin/rust-std-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/ -L/liana/rust-1.65.0-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/" >> rustc_wrapper.sh && \ + echo "/liana/rust-1.70.0-x86_64-unknown-linux-gnu/rustc/bin/rustc \"\$@\" -L/liana/rust-1.70.0-x86_64-apple-darwin/rust-std-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/ -L/liana/rust-1.70.0-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/" >> rustc_wrapper.sh && \ chmod +x rustc_wrapper.sh ENV RUSTC="/liana/rustc_wrapper.sh" diff --git a/contrib/reproducible/docker/macos_cmd.sh b/contrib/reproducible/docker/macos_cmd.sh index e35fa7ec..bd6b6cd7 100755 --- a/contrib/reproducible/docker/macos_cmd.sh +++ b/contrib/reproducible/docker/macos_cmd.sh @@ -27,7 +27,7 @@ DARLING_DMG_REVISION=241238313a47d3cf6427ac5a75b7a0311a3a4cb4 \ cd .. # Finally build the projects using the toolchain just created. -alias cargo="/liana/rust-1.65.0-x86_64-unknown-linux-gnu/cargo/bin/cargo" +alias cargo="/liana/rust-1.70.0-x86_64-unknown-linux-gnu/cargo/bin/cargo" PATH="$PATH:$PWD/osxcross/target/bin/" \ CC=o64-clang \ diff --git a/contrib/reproducible/docker/windows.Dockerfile b/contrib/reproducible/docker/windows.Dockerfile index ff12ff58..c66b2714 100644 --- a/contrib/reproducible/docker/windows.Dockerfile +++ b/contrib/reproducible/docker/windows.Dockerfile @@ -10,26 +10,26 @@ RUN apt update && apt satisfy -y \ "gcc (>=10.2, <=10.2)" # Download the cargo binary and compiled stdlib from the distributed releases to make sure to build with -# the very same toolchain. We use 1.65.0 because it is unfortunately the MSRV of the GUI. -RUN curl -O "https://static.rust-lang.org/dist/rust-1.65.0-x86_64-unknown-linux-gnu.tar.gz" && \ - echo "8f754fdd5af783fe9020978c64e414cb45f3ad0a6f44d045219bbf2210ca3cb9 rust-1.65.0-x86_64-unknown-linux-gnu.tar.gz" | sha256sum -c && \ - tar -xzf rust-1.65.0-x86_64-unknown-linux-gnu.tar.gz && \ - curl -O "https://static.rust-lang.org/dist/rust-1.65.0-x86_64-pc-windows-gnu.tar.gz" && \ - echo "eaa0d89511739c16d2a6149ed3538ce10596c523c4791b4a378dde762cda77e4 rust-1.65.0-x86_64-pc-windows-gnu.tar.gz" | sha256sum -c && \ - tar -xzf rust-1.65.0-x86_64-pc-windows-gnu.tar.gz && \ +# the very same toolchain. We use 1.70.0 because it is unfortunately the MSRV of the GUI. +RUN curl -O "https://static.rust-lang.org/dist/rust-1.70.0-x86_64-unknown-linux-gnu.tar.gz" && \ + echo "8499c0b034dd881cd9a880c44021632422a28dc23d7a81ca0a97b04652245982 rust-1.70.0-x86_64-unknown-linux-gnu.tar.gz" | sha256sum -c && \ + tar -xzf rust-1.70.0-x86_64-unknown-linux-gnu.tar.gz && \ + curl -O "https://static.rust-lang.org/dist/rust-1.70.0-x86_64-pc-windows-gnu.tar.gz" && \ + echo "52945bf6ab861d05be100e88a95766760d2daff1a0c0a2eff32a7fd8071495bd rust-1.70.0-x86_64-pc-windows-gnu.tar.gz" | sha256sum -c && \ + tar -xzf rust-1.70.0-x86_64-pc-windows-gnu.tar.gz && \ rm -r *.tar.gz # NOTE: we were previously caching dependencies here (through `cargo vendor`). It's a tradeoff between the image size # and not needing internet access when running the image to build the software. # For some reason, we can't just set the RUSTFLAGS environment variable to add `-L` for compiling dependencies. -# This doesn't work: RUSTFLAGS="-L /liana/rust-1.65.0-x86_64-pc-windows-gnu/rust-std-x86_64-pc-windows-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/ -L /liana/rust-1.65.0-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/" +# This doesn't work: RUSTFLAGS="-L /liana/rust-1.70.0-x86_64-pc-windows-gnu/rust-std-x86_64-pc-windows-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/ -L /liana/rust-1.70.0-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/" # As a workaround, we use a wrapped `rustc` binary that always links against the windows stdlib we just downloaded. # Some issues that seem to be related: # https://github.com/rust-lang/rust/issues/40717 # https://github.com/rust-lang/rust/issues/48409 RUN echo "#!/bin/sh" > rustc_wrapper.sh && \ - echo "/liana/rust-1.65.0-x86_64-unknown-linux-gnu/rustc/bin/rustc \"\$@\" -L /liana/rust-1.65.0-x86_64-pc-windows-gnu/rust-std-x86_64-pc-windows-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/ -L /liana/rust-1.65.0-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/" >> rustc_wrapper.sh && \ + echo "/liana/rust-1.70.0-x86_64-unknown-linux-gnu/rustc/bin/rustc \"\$@\" -L /liana/rust-1.70.0-x86_64-pc-windows-gnu/rust-std-x86_64-pc-windows-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/ -L /liana/rust-1.70.0-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/" >> rustc_wrapper.sh && \ chmod +x rustc_wrapper.sh ENV RUSTC="/liana/rustc_wrapper.sh" diff --git a/contrib/reproducible/docker/windows_cmd.sh b/contrib/reproducible/docker/windows_cmd.sh index 414a3352..7162bc61 100755 --- a/contrib/reproducible/docker/windows_cmd.sh +++ b/contrib/reproducible/docker/windows_cmd.sh @@ -8,7 +8,7 @@ set -xe # Build the GUI for Windows. The Windows Portable Execution (PE) format contains some timestamps. # Instruct ld to set them to 0. -alias cargo="/liana/rust-1.65.0-x86_64-unknown-linux-gnu/cargo/bin/cargo" +alias cargo="/liana/rust-1.70.0-x86_64-unknown-linux-gnu/cargo/bin/cargo" RUSTFLAGS="-Clink-arg=-Wl,--no-insert-timestamp" \ cargo rustc \ --release \