about summary refs log tree commit diff
path: root/src/bootstrap
AgeCommit message (Collapse)AuthorLines
2024-06-30Distribute rustc_codegen_cranelift for arm64 macOSbjorn3-1/+3
2024-06-30Try renaming the file if removing failsChris Denton-1/+9
2024-06-29Rollup merge of #127002 - Kobzol:bootstrap-perf-tool, r=onur-ozkanMatthias Krüger-22/+15
Implement `x perf` as a separate tool Continues work from https://github.com/rust-lang/rust/pull/126318, adds a CLI for running `rustc-perf` profiling commands through a new `rustc-perf-wrapper` tool. The CLI is in a separate tool to enable experimentation outside of `bootstrap`. This is probably most of what we can do so far, I'll add support for benchmarking once `rustc-perf` gets a terminal output for comparing benchmark results. r? ``@onur-ozkan``
2024-06-29Review changesJakub Beránek-1/+1
2024-06-29Make mtime of reproducible tarball dependent on git commitJakub Beránek-1/+25
2024-06-29Rollup merge of #127112 - ChrisDenton:lldb, r=KobzolGuillaume Gomez-12/+14
Bootstrap: Don't get output if `lldb --version` errors fixes #126892 `Command` can error in two ways: the OS can fail to run the binary at all or else the binary can return an error exit code. Unfortunately the distinction between the two is not clear cut. The OS may succeed in starting the binary but it may still error before `main` (e.g. if a necessary library fails to load) and this will be reported via the exit code. Fortunately this case is simpler. We can assume that `lldb --version` will only ever error if there's a startup issue of some kind. so both kinds of errors are caused by the OS. Thus it's safe for us to treat them equally for the sake of this specific check.
2024-06-29Update test.rsChris Denton-15/+13
2024-06-29Don't get output if `lldb --version` errorsChris Denton-0/+4
2024-06-29Rollup merge of #127108 - onur-ozkan:bin-helper, r=KobzolMatthias Krüger-117/+166
unify `dylib` and `bin_helpers` and create `shared_helpers::parse_value_from_args` `dylib` and `bin_helpers` were already used in similar logic. This PR unifies them under a `shared_helpers` module that is utilized by both the bootstrap library and shims. Additionally, created `parse_value_from_args` with a unit test. This helps avoid code duplication in shims and can also be used in the bootstrap library if needed (which is the case in one of `@Kobzol's` tasks). r? `@Kobzol`
2024-06-29Rollup merge of #126822 - Kobzol:bootstrap-cmd-refactor-2, r=onur-ozkanMatthias Krüger-173/+262
Bootstrap command refactoring: port more `Command` usages to `BootstrapCmd` (step 2) This PR moves more of bootstrap to use `BooststrapCmd`, and also refactors the struct to allow it to serve as a proper command wrapper. Tracking issue: https://github.com/rust-lang/rust/issues/126819 Best reviewed commit-by-commit, I have been adding some helper impls along the way to ease the migration, and then later I remove some of them since they were no longer needed. r? `@onur-ozkan`
2024-06-29create `shared_helpers::parse_value_from_args`onur-ozkan-27/+69
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-06-29unify `bin_helpers` and `dylib` utility modulesonur-ozkan-47/+54
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-06-28Auto merge of #126701 - onur-ozkan:build-lld-if-enabled, r=Kobzolbors-7/+15
ignore `llvm::Lld` if lld is not enabled People are having trouble ([ref. zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/MSVC.20Runtime.20mismatch.20when.20building.20LLD)) when they don't want to build `lld` for their custom distribution tarballs even with `lld = false` in their config.toml. This is because it is not controlled by `lld_enabled` flag. This change ensures that `llvm:Lld` is controlled by lld configuration. Additionally, `lld = true` is set by default for dist profile, because we have been building it all along and this maintains that behavior. try-job: x86_64-mingw
2024-06-28Migrate more `Command` usages to `BootstrapCmd`Jakub Beránek-20/+17
2024-06-28Get rid of `Deref/DerefMut` impl for `BootstrapCmd`Jakub Beránek-37/+44
2024-06-28Migrate a few command usages to `BootstrapCommand`Jakub Beránek-20/+19
2024-06-28Migrate a few command usages to `BootstrapCommand`Jakub Beránek-30/+31
2024-06-28Migrate `cargo_clippy_cmd` and `cargo_miri_cmd` to `BootstrapCommand`Jakub Beránek-17/+15
2024-06-28Migrate some usage of `Command` to `BootstrapCmd`Jakub Beránek-19/+73
2024-06-28Make it easier to migrate `Command` to `BootstrapCmd`Jakub Beránek-6/+23
By allowing `run` to receive all of `BootstrapCmd`, `&mut BootstrapCmd`, `Command` and `&mut Command`.
2024-06-28Store `Command` directly inside `BootstrapCommand`Jakub Beránek-6/+31
This will make it easier to migrate existing commands to bootstrap command.
2024-06-28Improve documentation of `BootstrapCommand`Jakub Beránek-0/+12
2024-06-28Remove `run` and rename `run_tracked` to `run`Jakub Beránek-32/+23
2024-06-28Remove `run_cmd`Jakub Beránek-24/+12
2024-06-28add change-tracker entryonur-ozkan-0/+5
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-06-28add `lld = true` to default dist profileonur-ozkan-0/+1
Make sure lld is enabled for dist profile unless it is explicitly disabled. Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-06-28Rollup merge of #126470 - onur-ozkan:optional-cargo-submodule, r=KobzolMatthias Krüger-39/+32
make cargo submodule optional Right now, we fetch the cargo submodule no matter what, even if the command we are running doesn't need it (e.g., `x build compiler library`). This PR changes that to only fetch the cargo submodule when it's necessary. For more context, see the zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/Why.20is.20cargo.20always.20checked.20out.3F
2024-06-27remove unnecessary packages from `metadata::workspace_members`onur-ozkan-6/+5
Currently bootstrap doesn't use any inner paths from rust-analyzer and bootstrap with `ShouldRun::create_or_deps`. Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-06-27Auto merge of #126728 - onur-ozkan:stage1-rustdoc, r=Kobzolbors-12/+11
rustdoc: use current stage if download-rustc enabled When using download-rustc, using stage 1 rustdoc results in the wrong librustc_driver being used. ```sh $ ./build/host/stage1/bin/rustdoc --version ./build/host/stage1/bin/rustdoc: error while loading shared libraries: librustc_driver-7ff02ed05016d515.so: cannot open shared object file: No such file or directory ``` This change fixes that by not cutting the stage if download-rustc is enabled.
2024-06-27Cleanup bootstrap check-cfgUrgau-33/+4
2024-06-27Implement `x perf` as a separate toolJakub Beránek-22/+15
2024-06-27Auto merge of #126907 - glaubitz:sparc-fixes, r=nagisabors-3/+6
Fixes for 32-bit SPARC on Linux This PR fixes a number of issues which previously prevented `rustc` from being built successfully for 32-bit SPARC using the `sparc-unknown-linux-gnu` triplet. In particular, it adds linking against `libatomic` where necessary, uses portable `AtomicU64` for `rustc_data_structures` and rewrites the spec for `sparc_unknown_linux_gnu` to use `TargetOptions` and replaces the previously used `-mv8plus` with the more portable `-mcpu=v9 -m32`. To make `rustc` build successfully, support for 32-bit SPARC needs to be added to the `object` crate as well as the `nix` crate which I will be sending out later as well. r? nagisa
2024-06-27Auto merge of #126692 - DianQK:nixos-patchelf, r=Nilstriebbors-13/+8
patch `rust-lld` and `ld.lld` on NixOS When `rustc` uses its self-contained lld, we also need to patch `rust-lld` and `ld.lld`. The `rpath` for `rust-lld` is `$ORIGIN/../../../:$ORIGIN/../lib`, so I use `--add-rpath` instead of `--set-rpath`, which should be easier to maintain. I also changed `src/bootstrap/src/core/download.rs`, even this doesn't fix any known issues. For the `lld-wrapper.sh` of lld, refer to: https://github.com/rust-lang/rustc-dev-guide/pull/1999.
2024-06-26set `on-broken-pipe` in `prepare_cargo_tool`onur-ozkan-6/+9
Currently rustdoc breaks the build cache (due to having different rustflags) when building rustdoc before building another tool (e.g., `x test miri && x test rustdoc && x test miri`). This change fixes that by moving `on-broken-pipe` into `prepare_cargo_tool` so it is set for all tools. Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-06-24handle cargo submodule in a lazy-load wayonur-ozkan-1/+9
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-06-24refactor `tool_doc` macro in bootstraponur-ozkan-24/+18
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-06-24don't fetch/sync cargo submodule by defaultonur-ozkan-2/+1
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-06-24bootstrap: exclude cargo from package metadataonur-ozkan-8/+1
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-06-24bootstrap: Link against libatomic on 32-bit SPARCJohn Paul Adrian Glaubitz-3/+6
While at it, order the list of architectures alphabetically.
2024-06-24Rollup merge of #126298 - heiher:loongarch64-musl-ci, r=Mark-SimulacrumMatthias Krüger-1/+2
Promote loongarch64-unknown-linux-musl to Tier 2 with host tools MCP: https://github.com/rust-lang/compiler-team/issues/753 Tracking issue: https://github.com/rust-lang/rust/issues/122592 try-job: dist-loongarch64-musl
2024-06-23Rollup merge of #126616 - onur-ozkan:less-warnings, r=Mark-SimulacrumMatthias Krüger-5/+11
less bootstrap warnings This is how the build logs looks like currently: ```sh $ x build Building bootstrap Compiling bootstrap v0.0.0 (/home/nimda/devspace/onur-ozkan/rust/src/bootstrap) Finished `dev` profile [unoptimized] target(s) in 3.43s WARNING: no codegen-backends config matched the requested path to build a codegen backend. HELP: add backend to codegen-backends in config.toml. WARNING: creating symbolic link `/home/nimda/devspace/.other/rustc-builds/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/rustc-src/rust` to `/home/nimda/devspace/onur-ozkan/rust` failed with File exists (os error 17) Creating a sysroot for stage2 compiler (use `rustup toolchain link 'name' build/host/stage2`) WARNING: creating symbolic link `/home/nimda/devspace/.other/rustc-builds/build/x86_64-unknown-linux-gnu/ci-rustc-sysroot/lib/rustlib/rustc-src/rust` to `/home/nimda/devspace/onur-ozkan/rust` failed with File e xists (os error 17) Building tool rustdoc (stage1 -> stage2, x86_64-unknown-linux-gnu) Compiling rustdoc v0.0.0 (/home/nimda/devspace/onur-ozkan/rust/src/librustdoc) Compiling rustdoc-tool v0.0.0 (/home/nimda/devspace/onur-ozkan/rust/src/tools/rustdoc) Finished `release` profile [optimized + debuginfo] target(s) in 13.57s Build completed successfully in 0:00:17 ``` This PR removes artifact linking warnings and only shows the codegen-backend warning if explicitly called or during Dist or Install steps.
2024-06-23Rollup merge of #126230 - onur-ozkan:followup-126225, r=Mark-SimulacrumMatthias Krüger-29/+3
tidy: skip submodules if not present for non-CI environments Right now tidy requires rustc-perf to be fetched as it checks its license, but this doesn't make sense for most contributors since rustc-perf is a dist-specific tool and its license will not change frequently, especially during compiler development. This PR makes tidy to skip rustc-perf if it's not fetched and if it's not running in CI. Applies https://github.com/rust-lang/rust/pull/126225#issuecomment-2158143674 and reverts #126225.
2024-06-23Promote loongarch64-unknown-linux-musl to Tier 2 with host toolsWANG Rui-1/+2
MCP: https://github.com/rust-lang/compiler-team/issues/753
2024-06-23Rollup merge of #126782 - mtilda:mtilda/patch/x-test-with-absolute-paths, ↵Matthias Krüger-9/+29
r=onur-ozkan Support absolute source paths in bootstrap Fixes https://github.com/rust-lang/rust/issues/126765 `x test [PATHS]` should work when each path 1. Is the name of a build step, such as `tidy` in `x test tidy` or 2. Points to an existing file that is a descendant of the builder's source directory (root of this repository).
2024-06-22Support absolute `PATHS` in `x.py test [PATHS]`Mathilda-9/+29
2024-06-23Try to clarify the confusingly-named `RustDev` and `RustcDev` stepsZalathar-0/+9
2024-06-22Rollup merge of #126318 - Kobzol:bootstrap-perf, r=onur-ozkanMatthias Krüger-7/+140
Add a `x perf` command for integrating bootstrap with `rustc-perf` This PR adds a new `x perf` command to bootstrap. The idea is to let rustc developers profile (`profile_local`) and benchmark (`bench_local`) a stage1/stage2 compiler directly from within `rust`. Before, if you wanted to use `rustc-perf`, you had to clone it, set it up, copy the `rustc` sysroot after every change to `rust` etc. This is an attempt to automate that. I opened this PR mostly for discussion. My idea is to offer an interface that looks something like this (a random sample of commands): ```bash x perf --stage 2 profile eprintln x perf --stage1 profile cachegrind x perf benchmark --id baseline x perf benchmark --id after-edit x perf cmp baseline after-edit ``` In this PR, I'd like to only implement the simplest case (`profile_local (eprintln)`), because that only requires a single sysroot (you don't compare anything), and it's relatively easy to set up. Also, I'd like to avoid forcing developers to deal with the rustc-perf UI, so more complex use-cases (like benchmarking two sysroots and comparing the results) should probably wait for https://github.com/rust-lang/rustc-perf/issues/1734 (which is hopefully coming along soon-ish). I'm not sure if it's better to do this in bootstrap directly, or if I should create some shim tool that will receive a `rustc` sysroot, and offer a simplified CLI on top of `rustc-perf`. ## Why is a separate CLI needed? We definitely need to add some support to bootstrap to automate preparing `rustc-perf` and the `rustc` sysroot, but in theory after that we could just let people invoke `rustc-perf` manually. While that is definitely possible, you'd need to manually figure out where is your sysroot located, which seems annoying to me. The `rustc-perf` CLI is also relatively complex, and for this use-case it makes sense to only use a subset of it. So I thought that it would be better to offer a simplified interface on top of it that would make life easier for contributors. But maybe it's not worth it. CC `@onur-ozkan`
2024-06-22Rollup merge of #126731 - Kobzol:bootstrap-cmd-refactor, r=onur-ozkanGuillaume Gomez-106/+131
Bootstrap command refactoring: refactor `BootstrapCommand` (step 1) This PR is a first step towards https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap. It refactors `BoostrapCommand` to get it closer to a state where it is an actual command wrapper that can be routed through a central place of command execution, and also to make the distinction between printing output vs handling output programatically clearer (since now it's a mess). The existing usages of `BootstrapCommand` are complicated primarily because of different ways of handling output. There are commands that: 1) Want to eagerly print stdout/stderr of the executed command, plus print an error message if the command fails (output mode `PrintAll`). Note that this error message attempts to print stdout/stderr of the command when `-v` is enabled, but that will always be empty, since this mode uses `.status()` and not `.output()`. 2) Want to eagerly print stdout/stderr of the executed command, but do not print any additional error message if it fails (output mode `PrintOutput`) 3) Want to capture stdout/stderr of the executed command, but print an error message if it fails (output mode `PrintFailure`). This means that the user wants to either ignore the output or handle it programatically, but that's not obvious from the name. The difference between 1) and 2) (unless explicitly specified) is determined dynamically based on the bootstrap verbosity level. It is very difficult for me to wrap my head around all these modes. I think that in a future PR, we should split these axes into e.g. this: 1) Do I want to handle the output programmatically or print it to the terminal? This should be a separate axis, true/false. (Note that "hiding the output" essentially just means saying that I handle it programmatically, and then I ignore the output). 2) Do I want to print a message if the command fails? Yes/No/Based on verbosity (which would be the default). Then there is also the failure mode, but that is relatively simple to handle, the command execution will just shutdown bootstrap (either eagerly or late) when the command fails. Note that this is just a first refactoring steps, there are a lot of other things to be done, so some things might not look "final" yet. The next steps are (not necessarily in this order): - Remove `run` and `run_cmd` and implement everything in terms of `run_tracked` and rename `run_tracked` to `run` - Implement the refactoring specified above (change how output modes work) - Modify `BootstrapCmd` so that it stores `Command` instead of `&mut Command` and remove all the annoying `BootstrapCmd::from` by changing `Command::new` to `BootstrapCmd::new` - Refactor the rest of command executions not currently using `BootstrapCmd` that can access Builder to use the correct output and failure modes. This will include passing Builder to additional places. - Handle the most complex cases, such as output streaming. That will probably need to be handled separately. - Refactor the rest of commands that cannot access builder (e.g. `Config::parse`) by introducing a new command context that will be passed to these places, and then stored in `Builder`. Move certain fields (such as `fail_fast`) from `Builder` to the command context. - Handle the co-operation of `Builder`, `Build`, `Config` and command context. There are some fields and logic used during command execution that are distributed amongst `Builder/Build/Config`, so it will require some refactoring to make it work if the execution will happen on a separate place (in the command context). - Refactor logging of commands, so that it is either logged to a file or printed in a nice hierarchical way that cooperates with the `Step` debug hierarchical output. - Implement profiling of commands (add command durations to the command log, print a log of slowest commands and their execution counts at the end of bootstrap execution, perhaps store command executions to `metrics.json`). - Implement caching of commands. - Implement testing of commands through snapshot tests/mocking. Best reviewed commit by commit. r? ``@onur-ozkan``
2024-06-22Apply review comments.Jakub Beránek-5/+5
2024-06-22Wrap std `Output` in `CommandOutput`Jakub Beránek-12/+13