summary refs log tree commit diff
path: root/src/bootstrap/lib.rs
AgeCommit message (Collapse)AuthorLines
2022-06-23Auto merge of #97911 - dtolnay:numcpu, r=Mark-Simulacrumbors-3/+1
Revert "remove num_cpus dependency" in rustc and update cargo Fixes #97549. This PR reverts #94524 and does a Cargo update to pull in rust-lang/cargo#10737. Rust 1.61.0 has a regression in which it misidentifies the number of available CPUs in some environments, leading to enormously increased memory usage and failing builds. In between Rust 1.60 and 1.61 both rustc and cargo replaced some uses of `num_cpus` with `available_parallelism`, which eliminated support for cgroupv1, still apparently in common use. This PR switches both rustc and cargo back to using `num_cpus` in order to support environments where the available parallelism is controlled by cgroupv1. Both can use `available_parallism` again once it handles cgroupv1 (if ever). I have confirmed that the rustc part of this PR fixes the memory usage regression in my non-Cargo environment, and others have confirmed in #97549 that the Cargo regression was at fault for the memory usage regression in their environments.
2022-05-10Revert "Make "Assemble stage1 compiler" orders of magnitude faster"Joshua Nelson-3/+9
2022-05-10Auto merge of #96803 - jyn514:faster-assemble, r=Mark-Simulacrumbors-9/+3
Make "Assemble stage1 compiler" orders of magnitude faster This used to take upwards of 5 seconds for me locally. I found that the culprit was copying the downloaded LLVM shared object: ``` [22:28:03] Install "/home/jnelson/rust-lang/rust/build/x86_64-unknown-linux-gnu/ci-llvm/lib/libLLVM-14-rust-1.62.0-nightly.so" to "/home/jnelson/rust-lang/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libLLVM-14-rust-1.62.0-nightly.so" [22:28:09] c Sysroot { compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu(x86_64-unknown-linux-gnu) } } ``` It turned out that `install()` used full copies unconditionally. Change it to try using a hard-link before falling back to copying.
2022-05-08Make "Assemble stage1 compiler" orders of magnitude fasterJoshua Nelson-9/+3
This used to take upwards of 5 seconds for me locally. I found that the culprit was copying the downloaded LLVM shared object: ``` [22:28:03] Install "/home/jnelson/rust-lang/rust/build/x86_64-unknown-linux-gnu/ci-llvm/lib/libLLVM-14-rust-1.62.0-nightly.so" to "/home/jnelson/rust-lang/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libLLVM-14-rust-1.62.0-nightly.so" [22:28:09] c Sysroot { compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu(x86_64-unknown-linux-gnu) } } ``` It turned out that `install()` used full copies unconditionally. Change it to try using a hard-link before falling back to copying.
2022-05-08Auto merge of #96457 - yungkneez:fix-bootstrap, r=Mark-Simulacrumbors-2/+7
Initialize rust-analyzer submodule on bootstrap Fixes #96456
2022-05-01Initialize rust-analyzer submodule on bootstrapyungkneez-2/+7
2022-04-24Use `build/tmp` instead of adding a dependency on `tempfile`.Joshua Nelson-15/+8
2022-04-24Move download-ci-llvm to rustbuildJoshua Nelson-0/+17
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-13Rollup merge of #95441 - AlecGoncharow:issue-95204-fix, r=Mark-SimulacrumDylan DPC-1/+11
Always use system `python3` on MacOS This PR includes 2 changes: 1. Always use the system Python found at `/usr/bin/python3` on MacOS 2. Removes the hard requirement on having `python` in your system path if you didn't specify alternatives. The proposed change will instead attempt to find and use in order: `python` -> `python3` -> `python2`. This change isn't strictly necessary but without any change to this check, the original issue inspiring this change will still exist. Fixes #95204 r? ```@jyn514```
2022-04-11[bootstrap] Grab the right FileCheck binary for dist when cross-compiling.Luqman Aden-2/+2
2022-04-10Auto merge of #95253 - jyn514:cargo-run, r=Mark-Simulacrumbors-1/+1
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 https://github.com/rust-lang/rust/issues/94829.
2022-04-10Auto merge of #95502 - jyn514:doc-rustc, r=Mark-Simulacrumbors-0/+3
Fix `x doc compiler/rustc` This also has a few cleanups to `doc.rs`. The last two commits I don't care about, but the first commit I'd like to keep - it will be very useful for https://github.com/rust-lang/rust/issues/44293. Fixes https://github.com/rust-lang/rust/issues/95447.
2022-04-09Make it possible to run `cargo test` for bootstrapJoshua Nelson-1/+1
Note that this only runs bootstrap's self-tests, not compiler or library tests.
2022-03-30Simplify `make_run` for `test::Crate` by introducing `crate_paths` instead ↵Joshua Nelson-0/+3
of calculating them after the fact
2022-03-31Rollup merge of #94806 - jyn514:cargo-run-tidy, r=Mark-SimulacrumDylan DPC-1/+7
Fix `cargo run tidy` When I implemented rust-only bootstrapping in https://github.com/rust-lang/rust/pull/92260, I neglected to test stage0 tools - it turns out they were broken because they couldn't find the sysroot of the initial bootstrap compiler. This fixes stage0 tools by using `rustc --print sysroot` instead of assuming rustc is already in a sysroot and hard-coding the relative directory. Fixes https://github.com/rust-lang/rust/issues/94797 (properly, without having to change rustup).
2022-03-29bootstrap: force system python3 on MacOSAlec Goncharow-1/+11
2022-03-28Propagate `parallel_compiler` feature through rustc crates. Turned off ↵klensy-5/+9
feature gives change of builded crates: 238 -> 224.
2022-03-13Auto merge of #94738 - Urgau:rustbuild-check-cfg-values, r=Mark-Simulacrumbors-0/+9
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-10Fix `cargo run tidy`Joshua Nelson-1/+7
When I implemented rust-only bootstrapping in https://github.com/rust-lang/rust/pull/92260, I neglected to test stage0 tools - it turns out they were broken because they couldn't find the sysroot of the initial bootstrap compiler. This fixes stage0 tools by using `rustc --print sysroot` instead of assuming rustc is already in a sysroot and hard-coding the relative directory.
2022-03-09Rollup merge of #94772 - Urgau:check-cfg-miri, r=petrochenkovMatthias Krüger-1/+0
Add miri to the well known conditional compilation names and values This pull request adds `miri` to the list of well known names and values of the conditional compilation checking (`--check-cfg`). This was brought up in [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/RFC.203013.3A.20Checking.20conditional.20compilation.20at.20compile.20time/near/274513827) when discussing about the future of `--check-cfg`. r? ``@petrochenkov``
2022-03-09Add miri to the well known conditional compilation names and valuesLoïc BRANSTETT-1/+0
2022-03-09Enable conditional checking of values in the Rust codebaseLoïc BRANSTETT-0/+9
2022-03-07copy over `std::path::absolute` instead of adding `canonicalize` hacksJoshua Nelson-0/+16
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-07Don't depend on python for RUST_BOOTSTRAP_CONFIGJoshua Nelson-1/+1
2022-03-05Merge build_helper into utilbjorn3-3/+3
2022-03-05Remove build_helperbjorn3-7/+5
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-04Auto merge of #94298 - Urgau:rustbuild-check-cfg, r=Mark-Simulacrumbors-0/+28
Enable conditional compilation checking on the Rust codebase This pull-request enable conditional compilation checking on every rust project build by the `bootstrap` tool. To be more specific, this PR only enable well known names checking + extra names (bootstrap, parallel_compiler, ...). r? `@Mark-Simulacrum`
2022-03-04Rollup merge of #94524 - bjorn3:remove_num_cpus, r=Mark-SimulacrumMatthias Krüger-1/+3
Remove num_cpus dependency from bootstrap, build-manifest and rustc_s… …ession `std::threads::available_parallelism` was stabilized in rust 1.59. r? ```````````````````````````@Mark-Simulacrum```````````````````````````
2022-03-04Enable conditional compilation checking on the Rust codebaseLoïc BRANSTETT-0/+28
2022-03-03bootstrap: correct reading of flags for llvmJon Gjengset-2/+12
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-03-02Remove num_cpus dependency from bootstrap, build-manifest and rustc_sessionbjorn3-1/+3
2022-02-23Always check cg_llvm with ./x.py checkbjorn3-2/+3
Previously it would be skipped if codegen-backends doesn't contain llvm.
2022-02-13Auto merge of #93685 - Mark-Simulacrum:drop-time, r=Mark-Simulacrumbors-19/+1
Drop time dependency from bootstrap This was only used for the inclusion of 'current' dates into our manpages, but it is not clear that this is practically necessary. The manpage is essentially never updated, and so we can likely afford to keep a manual date in these files. It also seems possible to just omit it, but that may cause other tools trouble, so avoid doing that for now. This is largely done to reduce bootstrap complexity; the time crate is not particularly small and in #92480 would have started pulling in num-threads, which does runtime thread count detection. I would prefer to avoid that, so filing this to just drop the nearly unused dependency entirely. r? `@pietroalbini`
2022-02-07Drop time dependency from bootstrapMark Rousskov-19/+1
This was only used for the inclusion of 'current' dates into our manpages, but it is not clear that this is practically necessary. The manpage is essentially never updated, and so we can likely afford to keep a manual date in these files. It also seems possible to just omit it, but that may cause other tools trouble, so avoid doing that for now.
2022-02-06Use shallow clones for submodules managed by rustbuild, not just bootstrap.pyJoshua Nelson-1/+1
I missed this in https://github.com/rust-lang/rust/pull/89757; it made `x.py test src/bootstrap` very slow.
2022-01-30Hide failed command unless in verbose modeMark Rousskov-2/+2
This is particularly intended for invoking compiletest; the command line there is long (3,350 characters on my system) and takes up a lot of screen real estate for little benefit to the majority of those running bootstrap. This moves printing it to verbose mode (-v must be passed) which means that it's still possible to access when needed for debugging. The main downside is that CI logs will by-default become less usable for debugging (particularly) spurious failures, but it is pretty rare for us to really need the information there -- it's usually fairly obvious what is being run with a little investigation.
2022-01-01Remove some dead codebjorn3-5/+0
2021-12-04Use IntoIterator for array impl everywhere.Mara Bos-1/+1
2021-11-26Fix bug where submodules wouldn't be updated when running x.py from a ↵Joshua Nelson-1/+1
subdirectory Previously, it would concatenate the relative path to the current subdirectory, which looked at the wrong folder. I tested this by checking out `1.56.1`, changing the current directory to `src/`, and running `../x.py build`.
2021-10-23remove "field is never read" warningPietro Albini-1/+0
2021-09-19Restore the suggestion to set `ninja = false`.Daira Hopwood-1/+2
2021-09-19[bootstrap] Improve the error message when `ninja` is not found to link to ↵Daira Hopwood-2/+6
installation instructions. Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2021-08-26switch stage0.txt to stage0.json and add a tool to generate itPietro Albini-1/+1
2021-07-25Don't treat git repos as non-existent when `ignore_git` is setJoshua Nelson-1/+1
The new submodule handling depends on `is_git()` to be accurate to decide whether it should handle submodules at all or not. Unfortunately, `is_git()` treated "this directory does not have a git repository" and "this repository should not be used for SHA/version/commit date info" the same. This changes it to distinguish the two. To clarify: ignore_get is set by default whenever channel == "dev", which it is by default whenever you're compiling locally. So basically everyone would hit this, not just people who had explicitly configured ignore_git. Here's an example of an error this fixes: ``` $ x build Updating only changed submodules Submodules updated in 0.01 seconds Finished dev [unoptimized + debuginfo] target(s) in 0.17s warning: x.py has made several changes recently you may want to look at help: consider looking at the changes in `src/bootstrap/CHANGELOG.md` note: to silence this warning, add `changelog-seen = 2` at the top of `config.toml` Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu) Finished release [optimized] target(s) in 0.16s Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu) Building LLVM for x86_64-unknown-linux-gnu detected home dir change, cleaning out entire build directory running: "cmake" "/home/joshua/rustc3/src/llvm-project/llvm" "-G" "Ninja" "-DLLVM_ENABLE_ASSERTIONS=OFF" "-DLLVM_TARGETS_TO_BUILD=AArch64;ARM;BPF;Hexagon;MSP430;Mips;NVPTX;PowerPC;RISCV;Sparc;SystemZ;WebAssembly;X86" "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=AVR" "-DLLVM_INCLUDE_EXAMPLES=OFF" "-DLLVM_INCLUDE_DOCS=OFF" "-DLLVM_INCLUDE_BENCHMARKS=OFF" "-DLLVM_ENABLE_TERMINFO=OFF" "-DLLVM_ENABLE_LIBEDIT=OFF" "-DLLVM_ENABLE_BINDINGS=OFF" "-DLLVM_ENABLE_Z3_SOLVER=OFF" "-DLLVM_PARALLEL_COMPILE_JOBS=48" "-DLLVM_TARGET_ARCH=x86_64" "-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-unknown-linux-gnu" "-DLLVM_ENABLE_ZLIB=ON" "-DLLVM_ENABLE_LIBXML2=OFF" "-DLLVM_VERSION_SUFFIX=-rust-dev" "-DCMAKE_INSTALL_MESSAGE=LAZY" "-DCMAKE_C_COMPILER=gcc" "-DCMAKE_CXX_COMPILER=g++" "-DCMAKE_ASM_COMPILER=gcc" "-DCMAKE_C_FLAGS=-ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_FLAGS=-ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_INSTALL_PREFIX=/home/joshua/rustc3/build/x86_64-unknown-linux-gnu/llvm" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_BUILD_TYPE=Release" CMake Error: The source directory "/home/joshua/rustc3/src/llvm-project/llvm" does not exist. Specify --help for usage, or press the help button on the CMake GUI. thread 'main' panicked at ' command did not execute successfully, got: exit status: 1 build script failed, must exit now', /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.44/src/lib.rs:885:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace finished in 0.783 seconds Build completed unsuccessfully in 0:00:01 ```
2021-07-22Don't default to `submodules = true` unless the rust repo has a .git directoryJoshua Nelson-2/+2
2021-07-20Update all submodules that rustbuild doesn't depend on lazilyJoshua Nelson-5/+108
This only updates the submodules the first time they're needed, instead of unconditionally the first time you run x.py. Ideally, this would move *all* submodules and not exclude some tools and backtrace. Unfortunately, cargo requires all `Cargo.toml` files in the whole workspace to be present to build any crate. On my machine, this takes the time for an initial submodule clone (for `x.py --help`) from 55.70 to 15.87 seconds. This uses exactly the same logic as the LLVM update used, modulo some minor cleanups: - Use a local variable for `src.join(relative_path)` - Remove unnecessary arrays for `book!` macro and make the macro simpler to use - Add more comments
2021-06-26Auto merge of #86586 - Smittyvb:https-everywhere, r=petrochenkovbors-1/+1
Use HTTPS links where possible While looking at #86583, I wondered how many other (insecure) HTTP links were in `rustc`. This changes most other `http` links to `https`. While most of the links are in comments or documentation, there are a few other HTTP links that are used by CI that are changed to HTTPS. Notes: - I didn't change any to or in licences - Some links don't support HTTPS :( - Some `http` links were dead, in those cases I upgraded them to their new places (all of which used HTTPS)
2021-06-25Auto merge of #86015 - jyn514:revert-revert, r=Mark-Simulacrumbors-0/+6
Move LLVM submodule updates back to native.rs Time to find more bugs! The first commit is a straight revert of https://github.com/rust-lang/rust/pull/85647, the second is a fix for https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/x.2Epy.20always.20updates.20LLVM.20submodule/near/240113320 and https://github.com/rust-lang/rust/pull/82653#issuecomment-846755631. I haven't been able to replicate https://github.com/rust-lang/rust/pull/82653#issuecomment-849013698.
2021-06-23Use HTTPS links where possibleSmitty-1/+1
2021-06-07build doctests with lld if use-lld = trueThe8472-0/+15