rustup icon indicating copy to clipboard operation
rustup copied to clipboard

Support installing rustc by git hash

Open Ms2ger opened this issue 7 years ago • 10 comments

Ms2ger avatar Mar 09 '17 11:03 Ms2ger

https://static.rust-lang.org/dist/ would have to prepare pre-built binaries for each and every commit, which is unrealistic

nodakai avatar Mar 15 '17 06:03 nodakai

What's the status on this?

I reported a compiler bug a few days back that is blocking me from progressing, and there is a fix implemented, but it's not merged yet. Would love if this would be an option so that it would unblock me until the fix is merged into master.

axos88 avatar Oct 27 '23 21:10 axos88

@axos88 Sorry for the inconvenience! The members of the Rustup team has changed quite a few times since 2017, and as a newcomer here I'm still trying to pick up the lost context 🙇

rami3l avatar Oct 27 '23 23:10 rami3l

Nothing to explain @rami3l, it's unpaid open source software development, so thank you for putting in the effort! Let me know if you have any info on this, or even if you know of a good write-up on how to compile a specific version of the compiler from source and make it available to cargo.

Most of the articles I found were written for compiler development, and not my use case.

axos88 avatar Oct 28 '23 05:10 axos88

From a user's perspective, the ideal feature would be to be able to give rustup a github repo & commit sha / branch name / local path, and have it compile the compiler and necessary stuff from source.

axos88 avatar Oct 28 '23 06:10 axos88

Nothing to explain @rami3l, it's unpaid open source software development, so thank you for putting in the effort!

Many thanks for your understanding!

Let me know if you have any info on this, or even if you know of a good write-up on how to compile a specific version of the compiler from source and make it available to cargo.

The other day someone had the same question on Discord. I believe the info you need is in the Rust Compiler Development Guide.

In short, you'll need to:

  1. Prepare your source directory (the example uses rust-lang/rust, change it accordingly if necessary): git clone --depth 1 https://github.com/rust-lang/rust.git && cd rust;
  2. Make sure to git checkout the branch your want here;
  3. Setup a default config.toml profile: ./x setup compiler;
  4. Bootstrap the compiler till stage1, and build the stage1 std: ./x build library;
  5. Adopt it in Rustup: rustup toolchain link stage1 build/host/stage1;
  6. Now you can do rustc +stage1 example.rs or cargo +stage1 build.

rami3l avatar Oct 28 '23 10:10 rami3l

From a user's perspective, the ideal feature would be to be able to give rustup a github repo & commit sha / branch name / local path, and have it compile the compiler and necessary stuff from source.

I believe this is even more ambitious than the original feature request, which only asked for downloads for all the commit hashes that we have a prebuilt toolchain for.

Till this point, Rustup is still pretty much a toolchain downloader and installer. It can also adopt external toolchains though. IMHO building a custom Rust toolchain is considered a niche requirement and supporting this in Rustup has debatable added value.

rami3l avatar Oct 28 '23 10:10 rami3l

I have no idea about the complexities, so it was just wishful thinking. But this guide is more then enough, maybe it should be linked or documented in rustup and that would be more than enough.

One can also do a rustup default stage1 afterwards and use it as if it had been a recent nightly installation.

axos88 avatar Oct 28 '23 21:10 axos88

cc https://github.com/kennytm/rustup-toolchain-install-master

@rbtcollins (?) and i discussed this on discord at some point and he mentioned wanting to support a more general mechanism for alternate sources, but i'm not in that discord server anymore

jyn514 avatar Dec 04 '23 15:12 jyn514