What I’m trying to do:
Install a package into my environment that includes a rust library.
What I’ve tried and what’s not working:
The server has no rust compiler installed, so the package installation fails.
Is that something that could be added to the server environment?
3 Likes
+1 on this!
Cargo, the Rust package manager, is not installed or is not on PATH.
This package requires Rust and Cargo to compile extensions. Install it through
the system's package manager or via https://rustup.rs/
This is what I’ve tried so far. On the page Setting: Python Version, under Advanced Settings, I set the pre-install script to:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source "$HOME/.cargo/env"
export PATH=$HOME/.cargo/bin:$PATH
echo $PATH
cargo —version
The output below shows that this builds and installs correctly (last two lines are $PATH
and cargo --version
)
Assembling config...Done
Loading base image...Done
Running pre-install script...
info: downloading installer
info: profile set to 'default'
info: default host triple is x86_64-unknown-linux-gnu
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on [2023-06-01](canary:event?ts=707306405.00), rust version 1.70.0 (90c541806 [2023-05-31](canary:event?ts=707220005.00))
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'rustfmt'
info: default toolchain set to 'stable-x86_64-unknown-linux-gnu'
stable-x86_64-unknown-linux-gnu installed - rustc 1.70.0 (90c541806 [2023-05-31](canary:event?ts=707220005.00))
Rust is installed now. Great!
To get started you may need to restart your current shell.
This would reload your PATH environment variable to include
Cargo's bin directory ($HOME/.cargo/bin).
To configure your current shell, run:
source "$HOME/.cargo/env"
/root/.cargo/bin:/root/.cargo/bin:/home/anvil/.env/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/anvil-shared/bin
cargo 1.70.0 (ec8a8a0ca [2023-04-25](canary:event?ts=704109605.00))
But then at the very end (about 1 minute later) I get Error: Build failed with no reason added. I’ve sometimes seen an Error related to Image Size Limit, but only intermittently.