Building rust from source, additional steps

Hello all!

I am trying to build rust (1.64.0) on x86_64 from source. I downloaded rust_lang/rust. In my case basically, the distro doesn't have any rust packages and it is an impossible to install them by standard paths.

After "x.py install" I got the rustc in "prefix/bin". But cargo is absent. There are only "rustc rustdoc rust-gdb rust-gdbgui rust-lldb" binaries.

  1. How to build and install all set of rust binaries from source including cargo and etc? (The distro doesn't have preinstalled cargo.)

  2. Utility x.py downloads additional git-projects in a building process. How to list a whole set of such projects and tune their source origins?

  3. As I see, utility x.py downloads bootstrap "package", which contains libobject-N.rlib. In other hand, (by default) x.py doesn't download git-project for libobject and doesn't build this library from source. The prebuilt library libobject just is coping from bootstrap to stage0, ..., from stage1 to install prefix. How to download and build libobject and other such libraries from source?

// Enable a build of the extended Rust tool set which is not only the compiler
// but also tools such as Cargo. This will also produce "combined installers"
// which are used to install Rust and Cargo together. This is disabled by
// default. The tools option (immediately below) specifies which tools should
// be built if extended = true.
//extended = false

So, the building of cargo is ruled by "extended" flag.

Possibly,

// 2) Download additional projects
cd rust && git submodule update --init

// 3) Download packages
cargo vendor -s src/tools/rust-analyzer/Cargo.toml -s\ compiler/rustc_codegen_cranelift/Cargo.toml -s src/bootstrap/Cargo.toml

But the answer from the developers will be more accurate.

Can you use rustup to install the stable 1.64.0 toolchain on your machine?

1 Like

I will try to read about rustup.

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.