User:Trickygnome/Rust from sources installation

From Gentoo Wiki
Jump to:navigation Jump to:search

Rust programming language compiler is written in Rust, it was created to be built by a precompiled binary version of itself called "snapshot".

But there is project called Mrustc - Alternative rust compiler (re-implementation) - written in C++ that is able to bootstrap Rust compiler from rustc sources without binary "snapshot".

Gentoo provide users a choice to install Rust from sources with "mrustc-bootstrap" or with dependency to binary package dev-lang/rust-bin with "snapshot" Rust compiler.

Steps to install Rust with Mrustc

First, we prohibit instalation of binary package with "snapshot Rust compiler.

root #echo "dev-lang/rust-bin" >> /etc/portage/package.mask/rust

Drop the useflag mask:

root #mkdir -p /etc/portage/profile
root #echo "dev-lang/rust:1.74.1 -mrustc-bootstrap" >> /etc/portage/profile/package.use.mask

Enable the useflag:

root #echo "dev-lang/rust:1.74.1 mrustc-bootstrap" >> /etc/portage/package.use/misc

package.accept_keywords entry for mrustc:

root #echo "dev-lang/mrustc" >> /etc/portage/package.accept_keywords/misc

After that we build Rust "snapshot" Rust compiler with Mrustc compiler.

root #emerge -av dev-lang/rust:1.74.1

Finally, subsequently compile recent versions of Rust.

root #emerge -av dev-lang/rust