Skip to content

Commit 12b0865

Browse files
authored
fix(rust): Install gcc-multilib only in amd64 (#440)
* fix: install gcc-multilib only in amd64 Signed-off-by: bkioshn <[email protected]> * fix: use trixie image and use target from debian Signed-off-by: bkioshn <[email protected]> * fix: update rust to 1.89 Signed-off-by: bkioshn <[email protected]> --------- Signed-off-by: bkioshn <[email protected]>
1 parent 186f890 commit 12b0865

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

earthly/rust/Earthfile

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@ VERSION 0.8
77
# FUNCTIONs or targets in that Earthfile MUST be shimmed here.
88
# No other earthfile should reference the rust library in the earthly/lib repo.
99
IMPORT github.com/earthly/lib/rust:3.0.3 AS rust
10-
1110
# Local Earthfile reference imports
1211
IMPORT ./tools AS rust-tools
1312
IMPORT ../../utilities/scripts AS scripts
13+
IMPORT ../debian AS debian
1414

1515
# cspell: words miri ripgrep toolset lcov psycopg
1616
# cspell: words TARGETPLATFORM TARGETOS TARGETARCH TARGETVARIANT USERPLATFORM USEROS USERARCH USERVARIANT
1717
# cspell: words findutils fileset pkgconfig wasip
1818

19+
ARG --global RUST_IMAGE="rust:1.89.0-slim-trixie"
20+
1921
# rust-base : Base Rustup build container.
2022
# Not called directly, used by other targets.
2123
rust-base:
@@ -31,7 +33,7 @@ rust-base:
3133
# This is our base Host toolset, and rustup.
3234
# Never use `rust-toolchain.toml` in CI as it breaks builds.
3335
# The only toolchain supported is the one installed here.
34-
FROM rust:1.88.0-slim-bookworm
36+
FROM $RUST_IMAGE
3537

3638
WORKDIR /root
3739

@@ -43,15 +45,15 @@ rust-base:
4345
#
4446
# Note: openssl-dev and openssl-libs-static are added to support the cargo-component crate.
4547
# if that crate is removed, these dependencies can also be removed.
46-
RUN apt-get update && apt-get install -y \
48+
LET PACKAGES= \
4749
bash \
4850
build-essential \
4951
clang \
5052
cmake \
5153
colordiff \
5254
findutils \
5355
fontconfig \
54-
fonts-liberation2 \
56+
fonts-liberation2 \
5557
graphviz \
5658
libssl-dev \
5759
mold \
@@ -61,9 +63,17 @@ rust-base:
6163
python3-rich \
6264
python3-psycopg \
6365
ripgrep \
64-
wget \
65-
gcc-multilib \
66-
&& rm -rf /var/lib/apt/lists/*
66+
wget
67+
68+
# Installing packages specifically to an architecture.
69+
IF [ "$TARGETARCH" = "amd64" ]
70+
# gcc-multilib only exist for x86_64 architecture
71+
SET PACKAGES= $PACKAGES \
72+
gcc-multilib
73+
END
74+
75+
DO debian+INSTALL --packages=$PACKAGES
76+
6777

6878
# Fix up font cache.
6979
RUN fc-cache -f
@@ -366,7 +376,7 @@ REMOVE_SOURCE_FINGERPRINTS:
366376

367377
# TODO(bkioshn): https://github.com/input-output-hk/catalyst-ci/issues/322
368378
# Installing Rust
369-
# Code reference from [rust1.88.0-slim-bookworm](https://github.com/rust-lang/docker-rust/blob/63f877a36f8ba9d9b4b35cd49df3327264510886/stable/bookworm/slim/Dockerfile)
379+
# Code reference from [rust1.88.0-slim-trixie](https://hub.docker.com/layers/library/rust/1.88-slim-trixie/images/sha256-8db8b00515a87166ed92befb71c87f5dcffbdc98e8a9e90b452a302495330cdd)
370380
INSTALL_RUST:
371381
FUNCTION
372382

@@ -375,19 +385,19 @@ INSTALL_RUST:
375385
ENV RUSTUP_HOME=/usr/local/rustup
376386
ENV CARGO_HOME=/usr/local/cargo
377387
ENV PATH=/usr/local/cargo/bin:$PATH
378-
ENV RUST_VERSION=1.88.0
388+
ENV RUST_VERSION=1.89.0
379389

380390
IF [ "$TARGETARCH" = "amd64" ]
381391
LET PLATFORM = "x86_64-unknown-linux-gnu"
382-
LET RUSTUP_SHA = "6aeece6993e902708983b209d04c0d1dbb14ebb405ddb87def578d41f920f56d"
392+
LET RUSTUP_SHA = "20a06e644b0d9bd2fbdbfd52d42540bdde820ea7df86e92e533c073da0cdd43c"
383393
ELSE IF [ "$TARGETARCH" = "arm64" ]
384394
LET PLATFORM = "aarch64-unknown-linux-gnu"
385-
LET RUSTUP_SHA = "1cffbf51e63e634c746f741de50649bbbcbd9dbe1de363c9ecef64e278dba2b2"
395+
LET RUSTUP_SHA = "e3853c5a252fca15252d07cb23a1bdd9377a8c6f3efa01531109281ae47f841c"
386396
ELSE
387397
RUN echo >&2 "unsupported architecture: ${TARGETARCH}"; exit 1
388398
END
389399

390-
LET URL = "https://static.rust-lang.org/rustup/archive/1.27.1/${PLATFORM}/rustup-init"
400+
LET URL = "https://static.rust-lang.org/rustup/archive/1.28.2/${PLATFORM}/rustup-init"
391401
RUN wget $URL && echo "${RUSTUP_SHA} *rustup-init" | sha256sum -c - \
392402
&& chmod +x rustup-init \
393403
&& ./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host $PLATFORM \

0 commit comments

Comments
 (0)