Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-bootstrapping from the *current* release #29556

Closed
brson opened this issue Nov 4, 2015 · 5 comments
Closed

Re-bootstrapping from the *current* release #29556

brson opened this issue Nov 4, 2015 · 5 comments

Comments

@brson
Copy link
Contributor

brson commented Nov 4, 2015

In some scenarios (I've forgotten offhand), distros want to rebuild the compiler using itself. This is more-or-less equivalent to starting the build at stage 2.

We'll provide a way in the Makefile to do this easily.

re https://internals.rust-lang.org/t/perfecting-rust-packaging-the-plan/2767

@cuviper
Copy link
Member

cuviper commented Apr 20, 2016

A self-rebuild will be required if there is any need to regenerate the Rust package. Rust x.y will already be in the distro buildroot, thus the prior x.(y-1) is no longer available, but perhaps we need to apply some bugfix or security patch to Rust, or relink due to a changed dependency, etc.

(Actually, I'm not sure how that will technically work, if something like LLVM gets rebased and we need to simultaneously use the old and link against the new. But that's a distro issue.)

Anyway, I may be able to work on this bug with some light mentoring hints. Can someone point to a starting point?

@alexcrichton
Copy link
Member

This might be easier as part of rustbuild rather than the makefiles (as it's in theory easier to read the dependency list). If you want to dive into the makefiles, the relevant targets start around here for libraries. For rustbuild, the list of dependencies show up in this file.

In rustbuild at least, this would probably look like:

  • Add a new target, libstd-fast or something like that (aka rustc-fast)
  • Set up the dependencies to not do any staging. E.g. avoid this - 1.
  • Add a sanity check at the base that the bootstrap compiler's version is the same as the listed source's version (and even if they match, perhaps print a warning that this may not work).
  • Bootstrap as usual, perhaps in a different location like build/$target/fast{,-std,-rustc}.

As for the Makefiles, well, I would perhaps avoid touching them if I were you :)

@cuviper
Copy link
Member

cuviper commented May 11, 2016

I've been banging my head on the makefiles, but I think I just had a eureka moment to simplify this. We don't actually need to skip any stages -- we just need to adjust how the stage0->1 build is configured. That's basically just the choice of RUSTC_BOOTSTRAP_KEY and --cfg stageN, anything else? A couple of easy conditionals instead of trying to restructure build dependencies...

@cuviper
Copy link
Member

cuviper commented May 15, 2016

@alexcrichton, could you please take at look at this gist patch? I don't expect it to be mergable yet, which is why I didn't open a PR, but I hope to get your opinion on the approach. Basically as I mentioned above, this still goes through all the same stages, but it treats the snapshot/local compiler as if it already has the stage1 features and the same bootstrap key.
https://gist.github.com/cuviper/5e35ff74c41f575d24c9940a03eb9d32

@alexcrichton
Copy link
Member

Looks reasonable to me! I'm not sure if it was intended to skip the bootstrap as part of this issue, but the plumbing there is at least what I'd expect

bors added a commit that referenced this issue May 24, 2016
Add --enable-local-rebuild to bootstrap from the current release

In Linux distributions, it is often necessary to rebuild packages for cases like applying new patches or linking against new system libraries.  In this scenario, the rustc in the distro build environment may already match the current release that we're trying to rebuild.  Thus we don't want to use the prior release's bootstrap key, nor `--cfg stage0` for the prior unstable features.

The new `configure --enable-local-rebuild` option specifies that we are rebuilding from the current release.  The current bootstrap key is used for the local rustc, and current stage1 features are also assumed.  Both the makefiles and rustbuild support this configuration.

Fixes #29556
r? @alexcrichton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants