Skip to content

Commit

Permalink
Merge #1413: bump gui msrv to 1.71.1
Browse files Browse the repository at this point in the history
456fce3 bump gui msrv to 1.71.1 (edouardparis)

Pull request description:

  This PR updates our build system to use rust 1.71.1, required by the last version of async-hwi

ACKs for top commit:
  edouardparis:
    Self-ACK 456fce3

Tree-SHA512: 2b5431d4ffc92d6f7dc03fd0524ea1f534489025c3e120f6be5f08af2c2c973908f03f1dabacfd74e9b3820d4e9d5cec0a4d6184c641c1b9096646a4508ea3ca
  • Loading branch information
edouardparis committed Nov 4, 2024
2 parents a061d8f + 456fce3 commit 472b070
Show file tree
Hide file tree
Showing 9 changed files with 200 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
strategy:
matrix:
toolchain:
- 1.70.0
- 1.71.1
- nightly
os:
- ubuntu-latest
Expand Down
18 changes: 9 additions & 9 deletions contrib/reproducible/docker/macos.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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.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 && \
# the very same toolchain. We use 1.71.1 because it is unfortunately the MSRV of the GUI.
RUN curl -O "https://static.rust-lang.org/dist/rust-1.71.1-x86_64-unknown-linux-gnu.tar.gz" && \
echo "34778d1cda674990dfc0537bc600066046ae9cb5d65a07809f7e7da31d4689c4 rust-1.71.1-x86_64-unknown-linux-gnu.tar.gz" | sha256sum -c && \
tar -xzf rust-1.71.1-x86_64-unknown-linux-gnu.tar.gz && \
curl -O "https://static.rust-lang.org/dist/rust-1.71.1-x86_64-apple-darwin.tar.gz" && \
echo "916056603da88336aba68bbeab49711cc8fdb9cfb46a49b04850c0c09761f58c rust-1.71.1-x86_64-apple-darwin.tar.gz" | sha256sum -c && \
tar -xzf rust-1.71.1-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.70.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.71.1-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.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 && \
echo "/liana/rust-1.71.1-x86_64-unknown-linux-gnu/rustc/bin/rustc \"\$@\" -L/liana/rust-1.71.1-x86_64-apple-darwin/rust-std-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/ -L/liana/rust-1.71.1-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"

Expand Down
2 changes: 1 addition & 1 deletion contrib/reproducible/docker/macos_cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ DARLING_DMG_REVISION=241238313a47d3cf6427ac5a75b7a0311a3a4cb4 \
cd ..

# Finally build the projects using the toolchain just created.
alias cargo="/liana/rust-1.70.0-x86_64-unknown-linux-gnu/cargo/bin/cargo"
alias cargo="/liana/rust-1.71.1-x86_64-unknown-linux-gnu/cargo/bin/cargo"

PATH="$PATH:$PWD/osxcross/target/bin/" \
CC=o64-clang \
Expand Down
18 changes: 9 additions & 9 deletions contrib/reproducible/docker/windows.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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.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 && \
# the very same toolchain. We use 1.71.1 because it is unfortunately the MSRV of the GUI.
RUN curl -O "https://static.rust-lang.org/dist/rust-1.71.1-x86_64-unknown-linux-gnu.tar.gz" && \
echo "34778d1cda674990dfc0537bc600066046ae9cb5d65a07809f7e7da31d4689c4 rust-1.71.1-x86_64-unknown-linux-gnu.tar.gz" | sha256sum -c && \
tar -xzf rust-1.71.1-x86_64-unknown-linux-gnu.tar.gz && \
curl -O "https://static.rust-lang.org/dist/rust-1.71.1-x86_64-pc-windows-gnu.tar.gz" && \
echo "15289233721ad7c3d697890d9c6079ca3b8a0f6740c080fbec3e8ae3a5ea5c8c rust-1.71.1-x86_64-pc-windows-gnu.tar.gz" | sha256sum -c && \
tar -xzf rust-1.71.1-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.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/"
# This doesn't work: RUSTFLAGS="-L /liana/rust-1.71.1-x86_64-pc-windows-gnu/rust-std-x86_64-pc-windows-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/ -L /liana/rust-1.71.1-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.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 && \
echo "/liana/rust-1.71.1-x86_64-unknown-linux-gnu/rustc/bin/rustc \"\$@\" -L /liana/rust-1.71.1-x86_64-pc-windows-gnu/rust-std-x86_64-pc-windows-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/ -L /liana/rust-1.71.1-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"

Expand Down
2 changes: 1 addition & 1 deletion contrib/reproducible/docker/windows_cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.70.0-x86_64-unknown-linux-gnu/cargo/bin/cargo"
alias cargo="/liana/rust-1.71.1-x86_64-unknown-linux-gnu/cargo/bin/cargo"
RUSTFLAGS="-Clink-arg=-Wl,--no-insert-timestamp" \
cargo rustc \
--release \
Expand Down
44 changes: 42 additions & 2 deletions contrib/reproducible/guix/manifest.scm
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
(use-modules
(gnu packages llvm)
(gnu packages rust)
(guix packages))
(guix packages)
(guix utils))

;; Stolen from Bitcoin Core. Some patches are needed to bootstrap a newer rustc.
(define-syntax-rule (search-our-patches file-name ...)
Expand Down Expand Up @@ -128,6 +129,45 @@ FILE-NAME found in ./patches relative to the current file."
;; for a precompiled library.
(patches (search-our-patches "rust-1.70-fix-rustix-build.patch")))))))

(define rust-1.71
(let ((base-rust
(rust-bootstrapped-package
rust-1.70 "1.71.1" "0bj79syjap1kgpg9pc0r4jxc0zkxwm6phjf3digsfafms580vabg")))
(package
(inherit base-rust)
(source
(origin
(inherit (package-source base-rust))
(snippet
'(begin
(for-each delete-file-recursively
'("src/llvm-project"
"vendor/openssl-src/openssl"
"vendor/tikv-jemalloc-sys/jemalloc"))
;; Adjust rustix to always build with cc.
(substitute* '("Cargo.lock"
"src/tools/cargo/Cargo.lock")
(("\"errno\",") "\"cc\",\n \"errno\","))
;; Add a dependency on the the 'cc' feature of rustix.
(substitute* '("vendor/is-terminal/Cargo.toml"
"vendor/is-terminal-0.4.6/Cargo.toml")
(("\"termios\"") "\"termios\", \"cc\""))
;; Also remove the bundled (mostly Windows) libraries.
(for-each delete-file
(find-files "vendor" "\\.(a|dll|exe|lib)$"))))))
(arguments
(substitute-keyword-arguments (package-arguments base-rust)
((#:phases phases)
`(modify-phases ,phases
(replace 'patch-cargo-checksums
(lambda _
(substitute* (cons* "Cargo.lock"
"src/bootstrap/Cargo.lock"
(find-files "src/tools" "Cargo.lock"))
(("(checksum = )\".*\"" all name)
(string-append name "\"" ,%cargo-reference-hash "\"")))
(generate-all-checksums "vendor"))))))))))

;; END of the newer rustc versions copied over from the current Guix master.

(let ((is_gui (getenv "IS_GUI")))
Expand All @@ -153,4 +193,4 @@ FILE-NAME found in ./patches relative to the current file."
;; resort to backporting the newer rustc releases here. Also have proper Guix packages
;; for the two projects.
(packages->manifest
`(,rust-1.70)))))
`(,rust-1.71)))))
12 changes: 6 additions & 6 deletions doc/BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ community). See [`CONTRIBUTING.md`](../CONTRIBUTING.md) for the currently minim
supported by `lianad`.

To build the GUI too, you'll unfortunately need a more recent Rust version. The minimum version
supported by the GUI at the moment is `1.70`. You will most likely have to [manually download
supported by the GUI at the moment is `1.71.1`. You will most likely have to [manually download
it](#by-manually-downloading-the-latest-stable-version) or [use `rustup`](#through-rustup) to
install more recent compilers.

Expand Down Expand Up @@ -50,11 +50,11 @@ And then you can download the archive corresponding to your system and CPU archi
signature and use the `cargo` binary from this archive to build Liana. Here is an example for
`amd64`:
```
$ curl -O https://static.rust-lang.org/dist/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-unknown-linux-gnu.tar.gz.asc
$ gpg --verify rust-1.70.0-x86_64-unknown-linux-gnu.tar.gz.asc
$ tar -xzf rust-1.70.0-x86_64-unknown-linux-gnu.tar.gz
$ ./rust-1.70.0-x86_64-unknown-linux-gnu/cargo/bin/cargo build --release
$ curl -O https://static.rust-lang.org/dist/rust-1.71.1-x86_64-unknown-linux-gnu.tar.gz
$ curl -O https://static.rust-lang.org/dist/rust-1.71.1-x86_64-unknown-linux-gnu.tar.gz.asc
$ gpg --verify rust-1.71.1-x86_64-unknown-linux-gnu.tar.gz.asc
$ tar -xzf rust-1.71.1-x86_64-unknown-linux-gnu.tar.gz
$ ./rust-1.71.1-x86_64-unknown-linux-gnu/cargo/bin/cargo build --release
```

### Through `rustup`
Expand Down
Loading

0 comments on commit 472b070

Please sign in to comment.