about summary refs log tree commit diff
path: root/src/bootstrap/builder.rs
AgeCommit message (Collapse)AuthorLines
2022-05-25Only allow `compiletest` to use `feature(test)`, not any other featureJoshua Nelson-1/+6
Using language features occasionally causes issues when using nightly to bootstrap, rather than beta. See #59264 for additional context.
2022-05-22Rollup merge of #97277 - jyn514:no-unstable-for-bootstrap, r=Mark-SimulacrumJack Huey-0/+8
Avoid accidentally enabling unstable features in compilers (take 2) This allows rustbuild to control whether crates can use nightly features or not. It also prevents rustbuild from using nightly features itself. This is #92261, but I fixed the CI error.
2022-05-22Disable unstable features in bootstrap toolsJoshua Nelson-0/+8
This statically prevents issues like https://github.com/rust-lang/rust/issues/59264, where tools can only be built with the in-tree compiler and not beta.
2022-05-14Fix rustc-perf benchmarksUrgau-3/+7
2022-05-08Fix the `x.py clippy` commandYuki Okushi-2/+2
2022-05-07Auto merge of #96670 - Urgau:bootstrap-check-cfg-features, r=Mark-Simulacrumbors-5/+14
Enable cfg checking of cargo features for everything but std This PR enable `cfg` checking of cargo features for everything but std, it also adds a `FIXME` to myself. > Note: `std`, `alloc` and `core` imports some dependencies by #[path] (like > backtrace, core_simd, std_float, ...), those dependencies have their own features > but cargo isn't involved in the #[path] and so cannot pass the complete list of > features, so for that reason we don't enable checking of features for std. r? `@Mark-Simulacrum`
2022-05-06Rollup merge of #96758 - davidtwco:split-debuginfo-bootstrap-bsd, ↵Michael Goulet-2/+6
r=Mark-Simulacrum bootstrap: bsd platform flags for split debuginfo Addresses https://github.com/rust-lang/rust/pull/96597#issuecomment-1118905025. Bootstrap currently provides `-Zunstable-options` for OpenBSD when using split debuginfo - this commit provides it for all BSD targets. We should probably work out a better way of handling the stability of the split debuginfo flag - all options for the flag are unstable but one of them is the default for each platform already. cc `@m-ou-se` r? `@Mark-Simulacrum`
2022-05-06Rollup merge of #96660 - jyn514:better-missing-path-error, r=Mark-SimulacrumMichael Goulet-1/+13
[bootstrap] Give a better error when trying to run a path with no registered step Before: ``` thread 'main' panicked at 'error: no rules matched invalid', src/bootstrap/builder.rs:287:17 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` After: ``` error: no `check` rules matched 'invalid' help: run `x.py check --help --verbose` to show a list of available paths note: if you are adding a new Step to bootstrap itself, make sure you register it with `describe!` ```
2022-05-06bootstrap: bsd platform flags for split debuginfoDavid Wood-2/+6
Bootstrap currently provides `-Zunstable-options` for OpenBSD when using split debuginfo - this commit provides it for all BSD targets. Signed-off-by: David Wood <david.wood@huawei.com>
2022-05-04Rollup merge of #96597 - semarie:split_debuginfo-unix, ↵Yuki Okushi-1/+2
r=davidtwco,Mark-Simulacrum openbsd: unbreak build on native platform after #95612, only linux and windows target are build with `-Zunstable-options`, but others platforms might use `-Csplit-debuginfo` currently, without this PR, the build of rustc on OpenBSD fails with: ``` Building stage0 tool unstable-book-gen (x86_64-unknown-openbsd) running: "/data/semarie/build-rust/install_dir/beta/bin/cargo" "build" "--target" "x86_64-unknown-openbsd" "-Zbinary-dep-depinfo" "-j" "4" "-v" "--release" "--frozen" "--manifest-path" "/data/semarie/build-rust/build_dir/rustc-nightly-src/src/tools/unstable-book-gen/Cargo.toml" "--message-format" "json-render-diagnostics" error: failed to run `rustc` to learn about target-specific information Caused by: process didn't exit successfully: `/data/semarie/build-rust/build_dir/build/bootstrap/debug/rustc - --crate-name ___ --print=file-names --cfg=bootstrap -Csymbol-mangling-version=v0 -Zmacro-backtrace -Clink-args=-Wl,-z,origin '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Csplit-debuginfo=off -Ztls-model=initial-exec --target x86_64-unknown-openbsd --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit status: 1) --- stdout Did not run successfully: exit status: 1 "/data/semarie/build-rust/install_dir/beta/bin/rustc" "-" "--crate-name" "___" "--print=file-names" "--cfg=bootstrap" "-Csymbol-mangling-version=v0" "-Zmacro-backtrace" "-Clink-args=-Wl,-z,origin" "-Clink-args=-Wl,-rpath,$ORIGIN/../lib" "-Csplit-debuginfo=off" "-Ztls-model=initial-exec" "--target" "x86_64-unknown-openbsd" "--crate-type" "bin" "--crate-type" "rlib" "--crate-type" "dylib" "--crate-type" "cdylib" "--crate-type" "staticlib" "--crate-type" "proc-macro" "--print=sysroot" "--print=cfg" "-Wrust_2018_idioms" "-Wunused_lifetimes" "-Wsemicolon_in_expressions_from_macros" "-Dwarnings" "--sysroot" "/data/semarie/build-rust/install_dir/beta" ------------- --- stderr error: `-Csplit-debuginfo` is unstable on this platform command did not execute successfully: "/data/semarie/build-rust/install_dir/beta/bin/cargo.bin" "build" "--target" "x86_64-unknown-openbsd" "-Zbinary-dep-depinfo" "-j" "4" "-v" "--release" "--frozen" "--manifest-path" ``` I am suspecting that all unix might be affected, but I am unsure about the right conditional to use. so I only added "openbsd" target inside it as I am able to test it. rustc nightly built correctly with this PR on openbsd.
2022-05-03Enable cfg checking of cargo features for everything but stdLoïc BRANSTETT-5/+14
2022-05-02[bootstrap] Give a better error when trying to run a path with no registered ↵Joshua Nelson-1/+13
step Before: ``` thread 'main' panicked at 'error: no rules matched invalid', src/bootstrap/builder.rs:287:17 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` After: ``` error: no `check` rules matched 'invalid' help: run `x.py check --help --verbose` to show a list of available paths note: if you are adding a new Step to bootstrap itself, make sure you register it with `describe!` ```
2022-05-02Auto merge of #96310 - bertptrs:remove-debugger-bootstrap, r=Mark-Simulacrumbors-1/+0
Remove DebbugerScripts from bootstrap CLI This PR implements #95992 and removes the debugger scripts from the bootstrap CLI. I could not find a lot of documentation on the bootstrap binary so perhaps there's still some documentation to be updated.
2022-05-02Remove DebbugerScripts from bootstrap CLIBert Peters-1/+0
2022-05-02openbsd: unbreak build on native platformSébastien Marie-1/+2
after #95612, only linux and windows target are build with -Zunstable-options, but others platforms might use -Csplit-debuginfo add "openbsd" target in the list of platforms using it.
2022-04-27Auto merge of #95170 - jyn514:ci-llvm, r=Mark-Simulacrumbors-1/+6
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 https://github.com/rust-lang/rust/pull/95234 to Rust; I can remove it if desired. Helps with https://github.com/rust-lang/rust/issues/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
2022-04-24Move download-ci-llvm to rustbuildJoshua Nelson-1/+6
This attempts to keep the logic as close to the original python as possible. `probably_large` has been removed, since it was always `True`, and UTF-8 paths are no longer supported when patching files for NixOS. I can readd UTF-8 support if desired. Note that this required making `llvm_link_shared` computed on-demand, since we don't know whether it will be static or dynamic until we download LLVM from CI.
2022-04-24Add type_name info to [TIMING] log outputJames Higgins-2/+11
2022-04-21Auto merge of #96003 - aswild:pr/bootstrap-subcommands-cleanup, r=jyn514bors-27/+35
bootstrap: consolidate subcommand parsing and matching There's several places where the x.py command names are matched as strings, leading to some inconsistencies and opportunities for cleanup. * Add Format, Clean, and Setup variants to builder::Kind. * Use Kind to parse the x.py subcommand name (including aliases) * Match on the subcommand Kind rather than strings when handling options and help text. * Several subcommands don't display any paths when run with `-h -v` even though the help text indicates that they should. Fix this and refactor so that manually keeping matches in sync isn't necessary. Fixes #95937
2022-04-21Auto merge of #95612 - davidtwco:split-debuginfo-in-bootstrap, r=Mark-Simulacrumbors-11/+11
bootstrap: add split-debuginfo config Replace `run-dysutil` option with more general `split-debuginfo` option that works on all platforms. r? `@Mark-Simulacrum`
2022-04-20bootstrap: non-bootstrap windows split debuginfoDavid Wood-7/+11
Temporarily, only enable split debuginfo on Windows if not building with the boostrap compiler as there is a bug that isn't fixed in the bootstrap compiler which would result in `thorin` being run on Windows. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-18Remove assertion that all paths in `ShouldRun` existJoshua Nelson-5/+7
This breaks on submodules (see #96188). Disable the assertion for now until I can think of a proper fix. This doesn't revert any of the changes in `Step`s themselves, only what `ShouldRun::paths` does.
2022-04-18Auto merge of #95906 - jyn514:enforce-valid-paths, r=Mark-Simulacrumbors-1/+24
Require all paths passed to `ShouldRun::paths` to exist on disk This has two benefits: 1. There is a clearer mental model of how bootstrap works. Steps correspond to paths on disk unless it's strictly impossible for them to do so (e.g. dist components). 2. Bootstrap has better checks for internal consistency. This caught several issues: - `src/sanitizers` doesn't exist; I changed it to just be a `sanitizers` alias. - `src/tools/lld` doesn't exist; I removed it, since `lld` alone already works. - `src/llvm` doesn't exist; removed it since `llvm` and `src/llvm-project` both work. - `src/lldb_batchmode.py` doesn't exist, it was moved to `src/etc`. - `install` was still using `src/librustc` instead of `compiler/rustc`. - None of the tools in `dist` / `install` allowed using `src/tools/X` to build them. This might be intentional - I can change them to aliases if you like. Builds on https://github.com/rust-lang/rust/pull/95901 and should not be merged before.
2022-04-18bootstrap: add split-debuginfo configDavid Wood-12/+8
Replace `run-dysutil` option with more general `split-debuginfo` option that works on all platforms. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-16bootstrap: consolidate subcommand parsing and matchingAllen Wild-27/+35
There's several places where the x.py command names are matched as strings, leading to some inconsistencies and opportunities for cleanup. * Add Format, Clean, and Setup variants to builder::Kind. * Use Kind to parse the x.py subcommand name (including aliases) * Match on the subcommand Kind rather than strings when handling options and help text. * Several subcommands don't display any paths when run with `-h -v` even though the help text indicates that they should. Fix this and refactor so that manually keeping matches in sync isn't necessary. Fixes #95937
2022-04-16Require all paths passed to `ShouldRun::paths` to exist on diskJoshua Nelson-1/+24
This has two benefits: 1. There is a clearer mental model of how bootstrap works. Steps correspond to paths on disk unless it's strictly impossible for them to do so (e.g. dist components). 2. Bootstrap has better checks for internal consistency. This caught several issues: - `src/sanitizers` doesn't exist; I changed it to just be a `sanitizers` alias. - `src/tools/lld` doesn't exist; I removed it, since `lld` alone already works. - `src/llvm` doesn't exist; removed it since `llvm` and `src/llvm-project` both work. - `src/lldb_batchmode.py` doesn't exist, it was moved to `src/etc`. - `install` was still using `src/librustc` instead of `compiler/rustc`. - None of the tools in `dist` / `install` allowed using `src/tools/X` to build them. This might be intentional - I can change them to aliases if you like.
2022-04-10bootstrap: show available paths help text for aliased subcommandsAllen Wild-3/+3
Running `./x.py build -h -v` shows a list of available build targets, but the short alias `./x.py b -h -v` does not. Fix so that the aliases behave the same as their spelled out counterparts.
2022-04-08Auto merge of #95440 - jyn514:error-index, r=Mark-Simulacrumbors-9/+13
Fix `x test src/tools/error_index_generator --stage {0,1}` There were two fixes needed: 1. Use `top_stage` instead of `top_stage - 1`. There was a long and torturous comment about trying to match rustdoc's version, but it works better without the hard-coding than with (before it gave errors that `libtest.so` couldn't be found). 2. Make sure that `ci-llvm/lib` is added to LD_LIBRARY_PATH. Previously the error index would be unable to load LLVM for stage0 builds. At some point we should probably have a discussion about how rustdoc stages should be numbered; confusion between 0/1/2 has come up several times in bootstrap now. cc https://github.com/rust-lang/rust/issues/92538 Note that this is still broken when using `download-rustc = true` and `--stage 1`, but that's *really* a corner case and should affect almost no one. `--stage {0,2}` work fine with download-rustc. Fixes https://github.com/rust-lang/rust/issues/80096.
2022-03-30Spellchecking some commentsYuri Astrakhan-1/+1
This PR attempts to clean up some minor spelling mistakes in comments
2022-03-29Fix `x test src/tools/error_index_generator --stage {0,1}`Joshua Nelson-9/+13
There were two fixes needed: 1. Use `top_stage` instead of `top_stage - 1`. There was a long and torturous comment about trying to match rustdoc's version, but it works better without the hard-coding than with. 2. Make sure that `ci-llvm/lib` is added to LD_LIBRARY_PATH. Previously the error index would be unable to load LLVM for stage0 builds. At some point we should probably have a discussion about how rustdoc stages should be numbered; confusion between 0/1/2 has come up several times in bootstrap now. Note that this is still broken when using `download-rustc = true` and `--stage 1`, but that's *really* a corner case and should affect almost no one. `--stage {0,2}` work fine with download-rustc.
2022-03-27[bootstrap] Don't print `Suite not skipped` unless `--verbose` is setJoshua Nelson-2/+2
This was so verbose before that it made it hard to see what effect the flag actually had. Before: ``` Set({test::src/tools/tidy}) not skipped for "bootstrap::test::Tidy" -- not in [src/test/ui, src/test/mir-opt/, src/test/debuginfo, src/test/ui-fulldeps] Skipping Suite(test::src/test/ui) because it is excluded Suite(test::src/test/run-pass-valgrind) not skipped for "bootstrap::test::RunPassValgrind" -- not in [src/test/ui, src/test/mir-opt/, src/test/debuginfo, src/test/ui-fulldeps] Skipping Suite(test::src/test/mir-opt) because it is excluded Suite(test::src/test/codegen) not skipped for "bootstrap::test::Codegen" -- not in [src/test/ui, src/test/mir-opt/, src/test/debuginfo, src/test/ui-fulldeps] Suite(test::src/test/codegen-units) not skipped for "bootstrap::test::CodegenUnits" -- not in [src/test/ui, src/test/mir-opt/, src/test/debuginfo, src/test/ui-fulldeps] Suite(test::src/test/assembly) not skipped for "bootstrap::test::Assembly" -- not in [src/test/ui, src/test/mir-opt/, src/test/debuginfo, src/test/ui-fulldeps] Suite(test::src/test/incremental) not skipped for "bootstrap::test::Incremental" -- not in [src/test/ui, src/test/mir-opt/, src/test/debuginfo, src/test/ui-fulldeps] Skipping Suite(test::src/test/debuginfo) because it is excluded Skipping Suite(test::src/test/ui-fulldeps) because it is excluded ... about 100 more lines ... ``` After: ``` Skipping Suite(test::src/test/ui) because it is excluded Skipping Suite(test::src/test/mir-opt) because it is excluded Skipping Suite(test::src/test/debuginfo) because it is excluded Skipping Suite(test::src/test/ui-fulldeps) because it is excluded ```
2022-03-16resolve the conflict in compiler/rustc_session/src/parse.rscodehorseman-1/+1
Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-15fix typosDylan DPC-1/+1
2022-03-13Auto merge of #94738 - Urgau:rustbuild-check-cfg-values, r=Mark-Simulacrumbors-1/+6
Enable conditional checking of values in the Rust codebase This pull-request enable conditional checking of (well known) values in the Rust codebase. Well known values were added in https://github.com/rust-lang/rust/pull/94362. All the `target_*` values are taken from all the built-in targets which is why some extra values were needed do be added as they are not (yet ?) defined in any built-in targets. r? `@Mark-Simulacrum`
2022-03-11Remove unneeded conversions in bootstrapping codepierwill-8/+4
Fixes warnings from `clippy::useless_conversion` in `src/bootstrap`.
2022-03-09Enable conditional checking of values in the Rust codebaseLoïc BRANSTETT-1/+6
2022-03-07copy over `std::path::absolute` instead of adding `canonicalize` hacksJoshua Nelson-3/+3
this also fixes a bug where bootstrap would try to use the fake `rustc` binary built by bootstrap - cargo puts it in a different directory when using `cargo run` instead of x.py
2022-03-05Merge build_helper into utilbjorn3-2/+1
2022-03-05Remove build_helperbjorn3-2/+1
The majority of the code is only used by either rustbuild or rustc_llvm's build script. Rust_build is compiled once for rustbuild and once for every stage. This means that the majority of the code in this crate is needlessly compiled multiple times. By moving only the code actually used by the respective crates to rustbuild and rustc_llvm's build script, this needless duplicate compilation is avoided.
2022-03-04Enable conditional compilation checking on the Rust codebaseLoïc BRANSTETT-0/+28
2022-03-03bootstrap: correct reading of flags for llvmJon Gjengset-3/+4
First, this reverts the `CFLAGS`/`CXXFLAGS` of #93918. Those flags are already read by `cc` and populated into `Build` earlier on in the process. We shouldn't be overriding that based on `CFLAGS`, since `cc` also respects overrides like `CFLAGS_{TARGET}` and `HOST_CFLAGS`, which we want to take into account. Second, this adds the same capability to specify target-specific versions of `LDFLAGS` as we have through `cc` for the `C*` flags: https://github.com/alexcrichton/cc-rs#external-configuration-via-environment-variables Note that this also necessitated an update to compiletest to treat CXXFLAGS separately from CFLAGS.
2022-01-30Rollup merge of #92887 - pietroalbini:pa-bootstrap-update, r=Mark-SimulacrumEric Huss-13/+4
Bootstrap compiler update r? ``@Mark-Simulacrum``
2022-01-28update cfg(bootstrap)sPietro Albini-13/+4
2022-01-23Auto merge of #93047 - matthiaskrgr:defer__dist_PlainSourceTarball, ↵bors-1/+5
r=Mark-Simulacrum build: dist: defer PlainSourceTarball Apparently it changes some tool sources and invalidates their fingerprints, forcing us to build them several times (before and after vendoring sources). I have not dug into why vendoring actually invalidates the figreprints, but moving the vendoring lower in the pipeline seems to avoid the issue. I could imagine that we somehow write a .cargo/config somewhere which somehow makes subsequent builds use the vendored deps but I was not able to find anything. I checked the sizes of generated archives pre and post patch and their are the same, so I hope there is no functional change. Fixes #93033
2022-01-21allow excluding paths only from a single modulePietro Albini-31/+117
x.py has support for excluding some steps from the invocation, but unfortunately that's not granular enough: some steps have the same name in different modules, and that prevents excluding only *some* of them. As a practical example, let's say you need to run everything in `./x.py test` except for the standard library tests, as those tests require IPv6 and need to be executed on a separate machine. Before this commit, if you were to just run this: ./x.py test --exclude library/std ...the execution would fail, as that would not only exclude running the tests for the standard library, it would also exclude generating its documentation (breaking linkchecker). This commit adds support for an optional module annotation in --exclude paths, allowing the user to choose which module to exclude from: ./x.py test --exclude test::library/std This maintains backward compatibility, but also allows for more ganular exclusion. More examples on how this works: | `--exclude` | Docs | Tests | | ------------------- | ------- | ------- | | `library/std` | Skipped | Skipped | | `doc::library/std` | Skipped | Run | | `test::library/std` | Run | Skipped | Note that the new behavior only works in the `--exclude` flag, and not in other x.py arguments or flags yet.
2022-01-21replace paths in PathSet with a dedicated TaskPath structPietro Albini-14/+28
2022-01-19build: dist: defer PlainSourceTarballMatthias Krüger-1/+5
Apparently it changes some tool sources and invalidates their fingerprints, forcing us to build them several times (before and after vendoring sources). I have not dug into why vendoring actually invalidates the figreprints, but the moving the vendoring lower in the pipeline seems to avoid the issue. I could imagine that we somehow write a .cargo/config somewhere which somehow makes subsequent builds use the vendored deps but I was not able to find anything. I checked the sizes of generated archives pre and post patch and their are the same, so I hope there is not functional change. Fixes #93033
2022-01-04Do not use deprecated -Zsymbol-mangling-version in bootstrapJakub Beránek-3/+13
2022-01-01Remove some dead codebjorn3-2/+1
2021-12-17pass -Wl,-z,origin to set DF_ORIGIN when using rpathSébastien Marie-0/+1
DF_ORIGIN flag signifies that the object being loaded may make reference to the $ORIGIN substitution string. Some implementations are just ignoring DF_ORIGIN and do substitution for $ORIGIN if present (whatever DF_ORIGIN pr Set the flag inconditionally if rpath is wanted.