Rust build possibly running out of RAM
Benji377 opened this issue · 8 comments
Intro
I am creating a Tauri app. It has a frontend in Next.js and the backend in Rust. Using the Tauri command with cargo, I can build the project for different platforms like Ubuntu, Windows and Mac. Unfortunately, I am not able to compile the project for the Raspberry Pi because it has a different chip architecture. Therefore, I wanted to use your runner to try and build it using GitHub actions.
Problem
When I execute the GitHub action, everything seems to work fine, up until it tries to install tauri with the cargo command: cargo install tauri-cli
. Then it starts compiling the needed dependencies and eventually fails because it doesn't have enough RAM to continue. It doesn't say that it doesn't have enough RAM, but when I tried to install tauri on my Raspberry Pi 3B+ with 1 GB of RAM, I encountered the same error. I solved it by increasing swap to 4 GB.
GitHub action
name: Raspberry Pi aarch64 cpu
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pguyot/arm-runner-action@v2.5.2
with:
image_additional_mb: 10240
base_image: https://dietpi.com/downloads/images/DietPi_RPi-ARMv8-Bullseye.7z
cpu: cortex-a53
commands: |
apt-get update -y --allow-releaseinfo-change
apt-get upgrade -y
apt-get autoremove -y
apt-get install curl
curl https://sh.rustup.rs -sSf | sh -s -- -y
. "$HOME/.cargo/env"
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash
apt-get install -y nodejs
npm install next@latest react@latest react-dom@latest eslint-config-next@latest
apt-get install -y libwebkit2gtk-4.0-dev build-essential wget libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev
cargo install tauri-cli
npm install
cargo tauri build
Action error
- Link to Action on Repository
- Link to Pastebin with entire log
Last couple of lines of the output from the GitHub actions:
2023-05-11T22:24:23.0259502Z Processing triggers for libgdk-pixbuf-2.0-0:arm64 (2.42.2+dfsg-1+deb11u1) ...
2023-05-11T22:24:23.3381137Z + cargo install tauri-cli
2023-05-11T22:24:24.0772696Z Updating crates.io index
2023-05-11T22:28:52.8116919Z Downloading crates ...
2023-05-11T22:28:53.3288241Z Downloaded tauri-cli v1.3.1
2023-05-11T22:28:54.7728017Z Installing tauri-cli v1.3.1
2023-05-11T22:29:00.9936668Z Downloading crates ...
2023-05-11T22:29:01.7668171Z Downloaded aead v0.5.2
2023-05-11T22:29:01.8475646Z Downloaded adler v1.0.2
...
2023-05-11T22:29:07.9532795Z Downloaded ring v0.16.20
2023-05-11T22:29:10.0836555Z Compiling libc v0.2.144
2023-05-11T22:29:10.0896293Z Compiling proc-macro2 v1.0.56
2023-05-11T22:34:58.0055244Z ##[error]The runner has received a shutdown signal. This can happen when the runner service is stopped, or a manually started runner is canceled.
2023-05-11T22:34:58.0217639Z ##[error]Process completed with exit code 143.
Well, never mind, I just run the free -m
command in the Runner, and it does have about 7 GB of RAM. That's more than the Raspberry I used with SWAP.
total used free shared buff/cache available
Mem: 6943 617 205 22 6121 6010
Swap: 4095 0 4095
I really don't know what the issue could be now
I executed df -h
just before the runner exits to check the size and here is the output:
+ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/loop3p2 11G 4.1G 6.0G 41% /
/dev/loop3p1 127M 32M 96M 26% /boot
devtmpfs 3.4G 0 3.4G 0% /dev
+ cargo install tauri-cli
After I execute the cargo install tauri-cli
command, the Runner exits.
@razr Maybe it has to do with disk space, but how do I increase it?
I'm doing it like this for the GH runner:
- name: Increase free space
# Remove Android and dotnet
run: |
df -h
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet
df -h
I see that you set image_additional_mb: 10240
. Maybe it should be more?
Unfortunately, even when doubling the size, I get the same error
This seems to be related:
rust-lang/rust#64248 (comment)
But the workaround (cleaning up registry), didn't work unfortunately.
https://github.com/pguyot/Raspirus/actions/runs/5039405198/jobs/9037523222#step:3:765
What you are saying is that this issue is more likely related to Rust not being able to download some crates, right?
The issue is Rust related. It's not that it cannot download crates but rather that it cannot download the index.
I did find a workaround and created a PR on your repo. It's still running but past the installation of taurus-cli.
See https://github.com/pguyot/Raspirus/actions/runs/5039610464/jobs/9037866452
Source for the workaround: libp2p/rust-libp2p#3782 (comment)