Skip to content

Commit a242a90

Browse files
committed
potential fix for cargo going OOM during 'updating crates.io index'
Fix found here: rust-lang/cargo#10583 This problem seems to exist on aarch64 building for amd64 and vice-versa.
1 parent 82eeaac commit a242a90

File tree

4 files changed

+39
-485
lines changed

4 files changed

+39
-485
lines changed

Earthfile

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ VERSION --use-cache-command 0.6
55
# - DevkitPro + its wii-dev package
66
# - Grrlib
77
build-env:
8-
FROM --platform=linux/amd64 ghcr.io/rust-lang/rust:nightly-slim
8+
FROM ghcr.io/rust-lang/rust:nightly-slim
99
WORKDIR /
1010
COPY ./docker/builder/install-devkitpro-pacman.sh /install-devkitpro-pacman.sh
1111
RUN chmod +x ./install-devkitpro-pacman.sh
@@ -45,17 +45,21 @@ build-env:
4545
rustup component add rust-src --toolchain nightly
4646
SAVE IMAGE --cache-from=ghcr.io/qqwy/wii-rust-build-env:latest wii-rust-build-env:latest
4747

48+
build-env-all-platforms:
49+
BUILD --platform=linux/arm64 --platform=linux/amd64 +build
50+
4851
# Build the main game Wii ROM
4952
build:
5053
# FROM +build-env
51-
FROM --platform=linux/amd64 ghcr.io/qqwy/wii-rust-build-env
54+
FROM ghcr.io/qqwy/wii-rust-build-env
5255
COPY ./app/ /app/
5356
WORKDIR /app/
5457
RUN --mount=type=cache,target=/usr/local/cargo/registry/index \
5558
--mount=type=cache,target=/usr/local/cargo/registry/cache \
5659
--mount=type=cache,target=/usr/local/cargo/git/db \
5760
cargo +nightly build -Z build-std=core,alloc --target powerpc-unknown-eabi.json
5861
SAVE ARTIFACT /build/target/powerpc-unknown-eabi/debug/rust-wii.elf AS LOCAL ./bin/boot.elf
62+
SAVE ARTIFACT ./Cargo.lock AS LOCAL ./app/Cargo.lock
5963

6064
# Build a Wii ROM that runs the on-target-device integration test suite.
6165
build-integration-test:
@@ -72,16 +76,18 @@ build-integration-test:
7276
# Run unit tests of the `app/lib` subcrate using the normal Rust test flow.
7377
unit-test:
7478
FROM --platform=linux/amd64 ghcr.io/rust-lang/rust:nightly-slim
75-
RUN --mount=type=cache,target=/usr/local/cargo/registry/index \
76-
--mount=type=cache,target=/usr/local/cargo/registry/cache \
77-
--mount=type=cache,target=/usr/local/cargo/git/db \
78-
rustup +nightly component add rust-src
79+
RUN apt update && apt install -y git
80+
# RUN --mount=type=cache,target=/usr/local/cargo/registry/index \
81+
# --mount=type=cache,target=/usr/local/cargo/registry/cache \
82+
# --mount=type=cache,target=/usr/local/cargo/git/db \
83+
RUN rustup +nightly component add rust-src
7984
COPY ./app/lib/ /app/lib/
8085
WORKDIR /app/lib/
81-
RUN --mount=type=cache,target=/usr/local/cargo/registry/index \
82-
--mount=type=cache,target=/usr/local/cargo/registry/cache \
83-
--mount=type=cache,target=/usr/local/cargo/git/db \
84-
cargo +nightly test --color=always
86+
# RUN --mount=type=cache,target=/usr/local/cargo/registry/index \
87+
# --mount=type=cache,target=/usr/local/cargo/registry/cache \
88+
# --mount=type=cache,target=/usr/local/cargo/git/db \
89+
RUN cargo +nightly test --color=always
90+
SAVE ARTIFACT ./Cargo.lock AS LOCAL ./app/lib/Cargo.lock
8591

8692
# BASE IMAGE CONTAINING DOLPHIN
8793
# -----------------------------
@@ -126,8 +132,8 @@ integration-test-runner:
126132

127133
# Copy ROM into image:
128134
RUN mkdir /build
129-
COPY +build-integration-test/rust-wii.elf /build/boot.elf
130-
# COPY ./bin/boot-test.elf /build/boot.elf
135+
# COPY +build-integration-test/rust-wii.elf /build/boot.elf
136+
COPY ./bin/boot-test.elf /build/boot.elf
131137

132138
# Run rest of the commands as unprivileged user:
133139
RUN adduser --disabled-password --gecos '' user
@@ -174,3 +180,12 @@ test:
174180
BUILD +unit-test # Unit test suite
175181
BUILD +integration-test
176182
# TODO Clippy?
183+
184+
185+
watch:
186+
LOCALLY
187+
RUN fswatch --one-per-batch --recursive ./app/src ./app/data ./app/Cargo.toml ./app/build.rs ./app/wrapper.h ./app/powerpc-unknown-eabi.json | \
188+
while read dir action file; do \
189+
echo -e "\e[1;34m The file '$file' appeared in directory '$dir' via '$action', rebuilding and retesting... \e[0m"; \
190+
FORCE_COLOR=1 earthly --use-inline-cache +build; \
191+
done

app/.cargo/config.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@ rustflags = ["-C", "default_linker_libraries=y"]
44

55
[unstable]
66
build-std = ["core", "compiler_builtins", "alloc"]
7-
build-std-features = ["compiler-builtins-mem"]
7+
build-std-features = ["compiler-builtins-mem"]
8+
9+
[net]
10+
git-fetch-with-cli = true

0 commit comments

Comments
 (0)