Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to allocate memory when installing a Rust toolchain (armv7-unknown-linux-gnueabihf) #2764

Closed
tatsuya6502 opened this issue May 10, 2021 · 6 comments

Comments

@tatsuya6502
Copy link

tatsuya6502 commented May 10, 2021

Problem

A user in a Japanese Rust community has reported that he/she cannot use Rustup v1.4.1 to install Rust to a Raspberry Pi 3 (with a 32-bit Arm Linux). It fails when unpacking a component due to a memory allocation error.

$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
info: downloading installer
Welcome to Rust!
...
 18.8 MiB /  18.8 MiB (100 %)   2.5 MiB/s in  6s ETA:  0s
info: installing component 'rustc'
 18.3 MiB /  84.0 MiB ( 22 %)   3.8 MiB/s in  5s ETA: 17smemory allocation of 16777216 bytes failed
Aborted

Another user in the community confirmed the problem using his Raspberry Pi 3.

Steps

  1. Run curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  • Expected result: The latest Rustup and Rust toolchain should be installed.
  • Actual result: The latest Rustup was installed but it failed to install a Rust toolchain with a memory allocation error.

Notes

  • Rustup: v1.4.1
  • Hardware: Raspberry Pi 3
  • OS: Raspbian Buster 32-bit (2020-02-13-raspbian-buster-lite)
  • Host Triple: armv7-unknown-linux-gnueabihf

This issue seems similar to #2759 (Windows MSVC) but in a different platform.

@tatsuya6502
Copy link
Author

As a workaround, I told them to use Rustup v1.3.1 for now and it worked for them.

Installing Rustup v1.3.1

$ TARGET_TRIPLE=armv7-unknown-linux-gnueabihf
$ curl -L -O https://static.rust-lang.org/rustup/archive/1.23.1/${TARGET_TRIPLE}/rustup-init
$ chmod +x rustup-init
$ ./rustup-init -y --default-toolchain none
$ source $HOME/.cargo/env
$ rustup -V
rustup 1.23.1 ...

Installing the latest Rust stable

$ RUSTUP_UNPACK_RAM=100000000 rustup install stable
...
thread 'main' panicked at 'RUSTUP_UNPACK_RAM must be larger than 220000000', src/dist/component/package.rs:202:13
...

$ RUSTUP_UNPACK_RAM=220000000 rustup install stable
...
  stable-armv7-unknown-linux-gnueabihf installed - rustc 1.52.0 (88f19c6da 2021-05-03)
info: default toolchain set to 'stable-armv7-unknown-linux-gnueabihf'
info: checking for self-updates
info: downloading self-update
$ rustc -V
rustc 1.52.0 (88f19c6da 2021-05-03)
$ cargo -V
cargo 1.52.0 (69767412a 2021-04-21)

@Arnavion
Copy link

I had the same issue on my Raspberry Pi 3 running Raspbian 10 arm32. RUSTUP_UNPACK_RAM=16777216 rustup update worked for me. I didn't have to also downgrade rustup to 1.23.1; just setting that env var was enough to make rustup 1.24.1 work.

@CliffHan
Copy link

I had the same issue on my Raspberry Pi 3 running Raspbian 10 arm32. RUSTUP_UNPACK_RAM=16777216 rustup update worked for me. I didn't have to also downgrade rustup to 1.23.1; just setting that env var was enough to make rustup 1.24.1 work.

I met same problem on cubietruck(like rpi3) running latest armbian(kernel 5.10.y). RUSTUP_UNPACK_RAM=16777216 works.

@rbtcollins
Copy link
Contributor

Yes, its the same problem as # #2759

@kinnison
Copy link
Contributor

I've updated the beta testing post on the users forum with details of how to test our proposed fix - https://internals.rust-lang.org/t/seeking-testers-for-rustup-1-24-2-beta/14634/6

@Arnavion
Copy link

I don't have an irlo account so I'll just confirm here; 1.24.2 fixes the issue for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants