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

Tracking Issue for removing python as the main bootstrap entry point #94829

Open
9 of 15 tasks
jyn514 opened this issue Mar 10, 2022 · 11 comments
Open
9 of 15 tasks

Tracking Issue for removing python as the main bootstrap entry point #94829

jyn514 opened this issue Mar 10, 2022 · 11 comments
Assignees
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.

Comments

@jyn514
Copy link
Member

jyn514 commented Mar 10, 2022

This is a tracking issue for removing the requirement on python for bootstrapping the compiler.
Note that bootstrap.py is never going to be removed altogether, since distros still need to get a bootstrap compiler from somewhere; this issue is about contributors who already have a rust toolchain installed.

The living document for this tracking issue is https://hackmd.io/j-XXBeYERuajJknd6zErPA?both.

In particular, this subsumes #71818.

About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

Steps

If you'd like to help with this feature, feel free to join the Zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/122652-new-members/topic/Help.20with.20RRIR.20bootstrap.20entrypoint.20.2394829

Unresolved Questions

  • Should we move the "Build completed successfully" output to rustbuild? If we keep it only in bootstrap.py, the new entry point will have less info; if we move it to bootstrap the info will be incomplete even for python users because it won't include the time to build rustbuild.

Implementation history

@rustbot label: +A-rustbuild +T-infra
cc @Mark-Simulacrum - I thought I'd write my plan down so you're not seeing PRs come in out of the blue.

@jyn514 jyn514 added the C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC label Mar 10, 2022
@rustbot rustbot added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Mar 10, 2022
jyn514 added a commit to jyn514/rust that referenced this issue Mar 11, 2022
Helps with rust-lang#94829.

This doesn't solve "bootstrap uses beta rustc but nightly rustfmt",
but in practice there should be very little difference between two.
Users can still override the toolchain used with `cargo +nightly` or similar.
@cuviper
Copy link
Member

cuviper commented Mar 14, 2022

Note that bootstrap.py is never going to be removed altogether, since distros still need to get a bootstrap compiler from somewhere;

Distros generally need offline builds, so I'm not sure what role you see for bootstrap.py there. For most builds I'm just pointing to the /usr toolchain, or if that's broken or non-existent I'll use a manually-unpacked upstream toolchain.

@jyn514
Copy link
Member Author

jyn514 commented Mar 20, 2022

Distros generally need offline builds, so I'm not sure what role you see for bootstrap.py there. For most builds I'm just pointing to the /usr toolchain, or if that's broken or non-existent I'll use a manually-unpacked upstream toolchain.

Ah, interesting. I'm a little confused why we ever had a python entry point then - @Mark-Simulacrum do you remember the original goal? Was it intended for individual users trying to build from source? I'm ok with regressing that a little bit as long as people can still install rustup from source and then build bootstrap ...

@bjorn3
Copy link
Member

bjorn3 commented Mar 20, 2022

bootstrap.py was introduced when rewriting the build system from make to rust in 046e687. Back then rustup (it was still called multirust at that point I believe) wasn't really common I believe.

@Mark-Simulacrum
Copy link
Member

The python wrapper supports us in a number of ways (or did): submodule initialization (needed before first Cargo invocation due to workspace resolution), downloading and checking hashes on a specific beta/stable (sort of replaceable with rustup, but historically our needs are a little more complex such as with rustfmt being a separate toolchain), figuring out what the platform target triple is...

It also does more "mundane" things like permitting a single interface to rustbuild without cargo run -- ... prefixing every command, which to me feels at least not obviously better than x.py. (And configuring that initial Cargo invocation with our linting requirements etc)

@bjorn3
Copy link
Member

bjorn3 commented Mar 20, 2022

Cargo allows adding aliases in .cargo/config.toml, so you can have eg cargo rustcbuild, cargo rustctest, ...

@jyn514
Copy link
Member Author

jyn514 commented Mar 20, 2022

It also does more "mundane" things like permitting a single interface to rustbuild without cargo run

We could have that unified interface with src/tools/x, which is also shorter than either x.py or cargo run. That seems nicer than having the interface tied to the language.

The other things are mostly done by rustup, or we could make them so - I guess the concern is for tooling in CI, which doesn't have rustup installed?

We could make submodules fully managed by rustbuild if we took it out of the workspace I think. That doesn't seem like a terribly bad regression; it mostly just means that it won't show up in cargo tree unless you run cd src/bootstrap first.

@jyn514
Copy link
Member Author

jyn514 commented Mar 20, 2022

I have divided this up into some smaller tasks that can be done in parallel; see https://rust-lang.zulipchat.com/#narrow/stream/122652-new-members/topic/Help.20with.20RRIR.20bootstrap.20entrypoint for more info.

@rustbot label: +E-mentor +E-help-wanted

@rustbot rustbot added E-help-wanted Call for participation: Help is requested to fix this issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. labels Mar 20, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Apr 9, 2022
…imulacrum

Fix `cargo run` on Windows

Fixes the following error:
```
error: failed to run custom build command for `bootstrap v0.0.0 (C:\Users\Walther\git\rust\src\bootstrap)`

Caused by:
  process didn't exit successfully: `C:\Users\Walther\git\rust\target\debug\build\bootstrap-7757a4777dec0f86\build-script-build` (exit code: 101)
  --- stdout
  cargo:rerun-if-changed=build.rs
  cargo:rerun-if-env-changed=RUSTC
  cargo:rustc-env=BUILD_TRIPLE=x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PATH

  --- stderr
  thread 'main' panicked at 'assertion failed: rustc.is_absolute()', src\bootstrap\build.rs:22:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed
```

The problem was that the `dir.join` check only works with `rustc.exe`, not `rustc`.

Thanks `@Walther` for the help testing the fix!

Helps with rust-lang#94829.
bors added a commit to rust-lang-ci/rust that referenced this issue Apr 10, 2022
…ulacrum

Fix `cargo run` on Windows

Fixes the following error:
```
error: failed to run custom build command for `bootstrap v0.0.0 (C:\Users\Walther\git\rust\src\bootstrap)`

Caused by:
  process didn't exit successfully: `C:\Users\Walther\git\rust\target\debug\build\bootstrap-7757a4777dec0f86\build-script-build` (exit code: 101)
  --- stdout
  cargo:rerun-if-changed=build.rs
  cargo:rerun-if-env-changed=RUSTC
  cargo:rustc-env=BUILD_TRIPLE=x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PATH

  --- stderr
  thread 'main' panicked at 'assertion failed: rustc.is_absolute()', src\bootstrap\build.rs:22:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed
```

The problem was that the `dir.join` check only works with `rustc.exe`, not `rustc`.

Thanks `@Walther` for the help testing the fix!

Helps with rust-lang#94829.
bors added a commit to rust-lang-ci/rust that referenced this issue Apr 10, 2022
Make it possible to run `cargo test` for bootstrap

Note that this only runs bootstrap's self-tests, not compiler or library tests.

Helps with rust-lang#94829.
bors added a commit to rust-lang-ci/rust that referenced this issue Apr 27, 2022
Move `download-ci-llvm` out of bootstrap.py

This is ready for review. It has been tested on Windows, Linux, and NixOS.

The second commit ports the changes from rust-lang#95234 to Rust; I can remove it if desired.

Helps with rust-lang#94829.

As a follow-up, this makes it possible to avoid downloading llvm until it's needed for building `rustc_llvm`; it would be nice to do that, but it shouldn't go in the first draft. It might also be possible to avoid requiring python until tests run (currently there's a check in `sanity.rs`), but I haven't looked too much into that.

`@rustbot` label +A-rustbuild
bors added a commit to rust-lang-ci/rust that referenced this issue Sep 24, 2022
Distribute bootstrap in CI

This pre-compiles bootstrap from source and adds it to the existing `rust-dev` component. There are two main goals here:
1. Make it faster to build rust from source, both the first time and incrementally
2. Make it easier to add non-python entrypoints, since they can call out to bootstrap directly rather than having to figure out the right flags to pre-compile it. This second part is still in a bit of flux, see the tracking issue below for more information.

There are also several changes to make bootstrap able to run on a machine other than the one it was built (particularly around `config.src` and `config.out` detection). I (`@jyn514)` am slightly concerned these will regress unless tested - maybe we should add an automated test that runs bootstrap in a chroot or something? Unclear whether the effort is worth the test coverage.

Helps with rust-lang#94829.
bors added a commit to rust-lang-ci/rust that referenced this issue Nov 14, 2022
…Simulacrum

Make all download functions need only Config, not Builder

This also adds a new `mod download` instead of scattering the download code across `config.rs` and `native.rs`.

This is the simplest and also most bit-rotty part of rust-lang#102282. Opening it earlier so it's not mixed in with behavior changes and to avoid rebase hell.

cc rust-lang#94829 (which nows has the hackmd linked).

r? `@Mark-Simulacrum`
@albertlarsan68

This comment was marked as resolved.

@onur-ozkan onur-ozkan removed E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. E-help-wanted Call for participation: Help is requested to fix this issue. labels Dec 5, 2023
@onur-ozkan onur-ozkan self-assigned this Dec 5, 2023
onur-ozkan added a commit to onur-ozkan/rust that referenced this issue Feb 29, 2024
Please note that we are currently validating the build configuration
on two entry points (e.g., profile validation is handled on the python side),
and change-tracker system is handled on the rust side. Once rust-lang#94829 is
completed (scheduled for 2024), we will be able to handle this more effectively.

Signed-off-by: onur-ozkan <[email protected]>
onur-ozkan added a commit to onur-ozkan/rust that referenced this issue Feb 29, 2024
Please note that we are currently validating the build configuration
on two entry points (e.g., profile validation is handled on the python side),
and change-tracker system is handled on the rust side. Once rust-lang#94829 is
completed (scheduled for 2024), we will be able to handle this more effectively.

Signed-off-by: onur-ozkan <[email protected]>
onur-ozkan added a commit to onur-ozkan/rust that referenced this issue Feb 29, 2024
Please note that we are currently validating the build configuration
on two entry points (e.g., profile validation is handled on the python side),
and change-tracker system is handled on the rust side. Once rust-lang#94829 is
completed (scheduled for 2024), we will be able to handle this more effectively.

Signed-off-by: onur-ozkan <[email protected]>
onur-ozkan added a commit to onur-ozkan/rust that referenced this issue Feb 29, 2024
Please note that we are currently validating the build configuration
on two entry points (e.g., profile validation is handled on the python side),
and change-tracker system is handled on the rust side. Once rust-lang#94829 is
completed (scheduled for 2024), we will be able to handle this more effectively.

Signed-off-by: onur-ozkan <[email protected]>
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 17, 2024
… r=albertlarsan68

run change tracker even when config parse fails

Please note that we are currently validating the build configuration on two entry points (e.g., profile validation is handled on the python side), and change tracker system is handled on the rust side. Once rust-lang#94829 is completed (scheduled for 2024), we will be able to handle this more effectively.

Fixes rust-lang#121756
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 17, 2024
Rollup merge of rust-lang#121787 - onur-ozkan:improve-change-tracker, r=albertlarsan68

run change tracker even when config parse fails

Please note that we are currently validating the build configuration on two entry points (e.g., profile validation is handled on the python side), and change tracker system is handled on the rust side. Once rust-lang#94829 is completed (scheduled for 2024), we will be able to handle this more effectively.

Fixes rust-lang#121756
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this issue Apr 20, 2024
Distribute bootstrap in CI

This pre-compiles bootstrap from source and adds it to the existing `rust-dev` component. There are two main goals here:
1. Make it faster to build rust from source, both the first time and incrementally
2. Make it easier to add non-python entrypoints, since they can call out to bootstrap directly rather than having to figure out the right flags to pre-compile it. This second part is still in a bit of flux, see the tracking issue below for more information.

There are also several changes to make bootstrap able to run on a machine other than the one it was built (particularly around `config.src` and `config.out` detection). I (`@jyn514)` am slightly concerned these will regress unless tested - maybe we should add an automated test that runs bootstrap in a chroot or something? Unclear whether the effort is worth the test coverage.

Helps with rust-lang/rust#94829.
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this issue Apr 27, 2024
Distribute bootstrap in CI

This pre-compiles bootstrap from source and adds it to the existing `rust-dev` component. There are two main goals here:
1. Make it faster to build rust from source, both the first time and incrementally
2. Make it easier to add non-python entrypoints, since they can call out to bootstrap directly rather than having to figure out the right flags to pre-compile it. This second part is still in a bit of flux, see the tracking issue below for more information.

There are also several changes to make bootstrap able to run on a machine other than the one it was built (particularly around `config.src` and `config.out` detection). I (`@jyn514)` am slightly concerned these will regress unless tested - maybe we should add an automated test that runs bootstrap in a chroot or something? Unclear whether the effort is worth the test coverage.

Helps with rust-lang/rust#94829.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

7 participants