Need help with installing rust compiler from tar.gz instead of init script directly

I was presently using this to install rust with a specific version:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs/ | sh -s -- --default-toolchain=1.78.0 -y

However, I do not want to proceed with this step due to compliance issues of my project. I need help with understanding alternative ways to download an install rust successfully.
Assume, I download the 1.78.0 release tar file, how can I use that to setup rust?

My ultimate goal is to upload the source from where I download rust to artifactory instead of consuming the url directly in my code.

There is a page documenting advanced installation methods. Is one of the listed ways of installing rustc appropriate for your project?

Standalone installers seem to be okay. Assuming I need to setup rust for rhel, ubuntu and windows, what tar.gz I should use for rhel/ubuntu and what msi for windows? And after downloading the tar, how to proceed? I am sorry but I did not clearly understand how to proceed...

Well, when choosing what installer to use, the platform is important. The platform, crudely speaking, consists of your CPU architecture, your OS and what libc you want to bind to. I think the most common platforms for Windows and Linux are x86_64-pc-windows-msvc and x86_64-unknown-linux-gnu, respectively.

Never used the standalone installers before, but there is an install.sh script in the tarball for linux, so executing that might be what you want on Linux. On Windows executing the MSI will open an installation wizard as far as I know.

1 Like

rust-1.78.0-x86_64-unknown-linux-gnu # ls
cargo rls-preview rustc rust-docs-json-preview components git-commit-info LICENSE-MIT version
clippy-preview rust-analysis-x86_64-unknown-linux-gnu rust-demangler-preview rustfmt-preview COPYRIGHT install.sh README.md
llvm-tools-preview rust-analyzer-preview rust-docs rust-std-x86_64-unknown-linux-gnu git-commit-hash LICENSE-APACHE rust-installer-version
:penguin: rust-1.78.0-x86_64-unknown-linux-gnu # ./install.sh
install: uninstalling component 'rustc'
install: uninstalling component 'rust-std-x86_64-unknown-linux-gnu'
install: uninstalling component 'rust-docs'
install: uninstalling component 'rust-docs-json-preview'
install: uninstalling component 'rust-demangler-preview'
install: uninstalling component 'cargo'
install: uninstalling component 'rustfmt-preview'
install: uninstalling component 'rls-preview'
install: uninstalling component 'rust-analyzer-preview'
install: uninstalling component 'llvm-tools-preview'
install: uninstalling component 'clippy-preview'
install: uninstalling component 'rust-analysis-x86_64-unknown-linux-gnu'
install: creating uninstall script at /usr/local/lib/rustlib/uninstall.sh
install: installing component 'rustc'
install: installing component 'rust-std-x86_64-unknown-linux-gnu'
install: installing component 'rust-docs'
install: installing component 'rust-docs-json-preview'
install: installing component 'rust-demangler-preview'
install: installing component 'cargo'
install: installing component 'rustfmt-preview'
install: installing component 'rls-preview'
install: installing component 'rust-analyzer-preview'
install: installing component 'llvm-tools-preview'
install: installing component 'clippy-preview'
install: installing component 'rust-analysis-x86_64-unknown-linux-gnu'

rust installed.

:penguin: rust-1.78.0-x86_64-unknown-linux-gnu # rustc --version
-bash: /root/.cargo/bin/rustc: No such file or directory

-Missing something here? Earlier with init script, I used to do this - source $HOME/.cargo/env to add rust to PATH. Something similar to be done after executing install.sh?

Rustc and cargo are installed into /usr/local/bin, not ~/.cargo/bin by default by the install script. This directory should already be in PATH by default, but it may be that you have leftovers from a rustup install for example.

1 Like

If I use a package manager directly for eg microdnf to install rust, that should work while building cryptograpy right?
I need to understand the difference in contents between rust installation via rustup and rust installation via a package manager for eg dnf install rust.

Using the rustc version from your package manager should work fine provided that the rustc version of your distro is new enough. I assume you are using Fedora based on the mention of dnf. The Fedora version is almost certainly new enough.

The thing is when I use rustup to directly configure rust and then add it to the path, everything works fine but when I use a rhel based package manager to download and install rust, building of cryptography fails.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.