about summary refs log tree commit diff
path: root/src/bootstrap/compile.rs
AgeCommit message (Collapse)AuthorLines
2023-04-25Add a `sysroot` crate to represent the standard library cratesJohn Kåre Alsaker-2/+2
2023-04-24Rollup merge of #110637 - oli-obk:gha, r=jyn514Matthias Krüger-44/+15
Group some sections of our logs in github actions This makes logs a little bit more readable as you can now collapse all the parts that don't interest you (and they get collapsed automatically) Obviously there's a lot more sites where we can/need to do this, too, but this is already helpful imo r? ```@jyn514```
2023-04-22Group entire build steps in the gha logsOli Scherer-44/+15
2023-04-21remove the early return in `Sysroot::run` which causes bypassing symlinkingozkanonur-1/+0
Signed-off-by: ozkanonur <work@onurozkan.dev>
2023-04-19Auto merge of #110229 - jyn514:download-rustc-tests, r=albertlarsan68bors-3/+48
Fix no_std tests that load libc from the sysroot when download-rustc is enabled There were a series of unfortunate interactions here. Here's an MCVE of the test this fixes (committed as `tests/ui/meta/no_std-extern-libc.rs`): ```rust #![crate_type = "lib"] #![no_std] #![feature(rustc_private)] extern crate libc; ``` Before, this would give an error about duplicate versions of libc: ``` error[E0464]: multiple candidates for `rlib` dependency `libc` found --> fake-test-src-base/allocator/no_std-alloc-error-handler-default.rs:15:1 | LL | extern crate libc; | ^^^^^^^^^^^^^^^^^^ | = note: candidate #1: /home/gh-jyn514/rust/build/aarch64-unknown-linux-gnu/stage2/lib/rustlib/aarch64-unknown-linux-gnu/lib/liblibc-358db1024b7d9957.rlib = note: candidate #2: /home/gh-jyn514/rust/build/aarch64-unknown-linux-gnu/stage2/lib/rustlib/aarch64-unknown-linux-gnu/lib/liblibc-ebc478710122a279.rmeta ``` Both these versions were downloaded from CI, but one came from the `rust-std` component and one came from `rustc-dev`: ``` ; tar -tf build/cache/f2d9a3d0771504f1ae776226a5799dcb4408a91a/rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz | grep liblibc rust-std-nightly-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-68a2d9e195dd6ed2.rlib ; tar -tf build/cache/f2d9a3d0771504f1ae776226a5799dcb4408a91a/rustc-dev-nightly-x86_64-unknown-linux-gnu.tar.xz | grep liblibc rustc-dev-nightly-x86_64-unknown-linux-gnu/rustc-dev/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-f226c9fbdd92a0fd.rmeta ``` The fix was to only copy files from `rust-std` unless a Step explicitly requests for the `rustc-dev` components to be available by calling `builder.ensure(compile::Rustc)`. To avoid having to re-parse the `rustc-dev.tar.xz` tarball every time, which is quite slow, this adds a new `build/host/ci-rustc/.rustc-dev-contents` cache file which stores only the names of files we need to copy into the sysroot. This also allows reverting the hack in https://github.com/rust-lang/rust/pull/110121; now that we only copy rustc-dev on-demand, we can correctly add the `Rustc` check artifacts into the sysroot, so that this works correctly even when `download-rustc` is forced to `true` and some tool depends on a local change to `compiler`. --- See https://github.com/rust-lang/rust/issues/108767#issuecomment-1501217657 for why `no_std` is required for the MCVE test to fail; it's complicated and not particularly important. Fixes https://github.com/rust-lang/rust/issues/108767.
2023-04-18Fix no_std tests that load libc when download-rustc is enabledJoshua Nelson-3/+48
There were a series of unfortunate interactions here. Here's an MCVE of the test this fixes (committed as `tests/ui/meta/no_std-extern-libc.rs`): ```rust #![crate_type = "lib"] #![no_std] #![feature(rustc_private)] extern crate libc; ``` Before, this would give an error about duplicate versions of libc: ``` error[E0464]: multiple candidates for `rlib` dependency `libc` found --> fake-test-src-base/allocator/no_std-alloc-error-handler-default.rs:15:1 | LL | extern crate libc; | ^^^^^^^^^^^^^^^^^^ | = note: candidate #1: /home/gh-jyn514/rust/build/aarch64-unknown-linux-gnu/stage2/lib/rustlib/aarch64-unknown-linux-gnu/lib/liblibc-358db1024b7d9957.rlib = note: candidate #2: /home/gh-jyn514/rust/build/aarch64-unknown-linux-gnu/stage2/lib/rustlib/aarch64-unknown-linux-gnu/lib/liblibc-ebc478710122a279.rmeta ``` Both these versions were downloaded from CI, but one came from the `rust-std` component and one came from `rustc-dev`: ``` ; tar -tf build/cache/f2d9a3d0771504f1ae776226a5799dcb4408a91a/rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz | grep liblibc rust-std-nightly-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-68a2d9e195dd6ed2.rlib ; tar -tf build/cache/f2d9a3d0771504f1ae776226a5799dcb4408a91a/rustc-dev-nightly-x86_64-unknown-linux-gnu.tar.xz | grep liblibc rustc-dev-nightly-x86_64-unknown-linux-gnu/rustc-dev/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-f226c9fbdd92a0fd.rmeta ``` The fix was to only copy files from `rust-std` unless a Step explicitly requests for the `rustc-dev` components to be available by calling `builder.ensure(compile::Rustc)`. To avoid having to re-parse the `rustc-dev.tar.xz` tarball every time, which is quite slow, this adds a new `build/host/ci-rustc/.rustc-dev-contents` cache file which stores only the names of files we need to copy into the sysroot. This also allows reverting the hack in https://github.com/rust-lang/rust/pull/110121; now that we only copy rustc-dev on-demand, we can correctly add the `Rustc` check artifacts into the sysroot, so that this works correctly even when `download-rustc` is forced to `true`. --- See https://github.com/rust-lang/rust/issues/108767#issuecomment-1501217657 for why `no_std` is required for the MCVE test to fail; it's complicated and not particularly important. Fixes https://github.com/rust-lang/rust/issues/108767.
2023-04-17Support `x test --stage 1 ui-fulldeps`jyn-0/+1
Nils had an excellent idea the other day: the same way that rustdoc is able to load `rustc_driver` from the sysroot, ui-fulldeps tests should also be able to load it from the sysroot. That allows us to run fulldeps tests with stage1, without having to fully rebuild the compiler twice. It does unfortunately have the downside that we're running the tests on the *bootstrap* compiler, not the in-tree sources, but since most of the fulldeps tests are for the *API* of the compiler, that seems ok. I think it's possible to extend this to `run-make-fulldeps`, but I've run out of energy for tonight. - Move `plugin` tests into a subdirectory. Plugins are loaded at runtime with `dlopen` and so require the ABI of the running compile to match the ABI of the compiler linked with `rustc_driver`. As a result they can't be supported in stage 1 and have to use `// ignore-stage1`. - Remove `ignore-stage1` from most non-plugin tests - Ignore diagnostic tests in stage 1. Even though this requires a stage 2 build to load rustc_driver, it's primarily testing the error message that the *running* compiler emits when the diagnostic struct is malformed. - Pass `-Zforce-unstable-if-unmarked` in stage1, not just stage2. That allows running `hash-stable-is-unstable` in stage1, since it now suggests adding `rustc_private` to enable loading the crates. - Add libLLVM.so to the stage0 target sysroot, to allow fulldeps tests that act as custom drivers to load it at runtime. - Pass `--sysroot stage0-sysroot` in compiletest so that we use the correct version of std.
2023-04-14Auto merge of #110263 - jyn514:ui-fulldeps-llvm, r=albertlarsan68bors-4/+5
Add `libLLVM.so` to the target libdir when download-rustc is enabled Previously, we would only add it to the host libdir, which meant it couldn't be loaded by `ui-fulldeps` tests that used rustc_private. Fixes https://github.com/rust-lang/rust/issues/110225, fixes https://github.com/rust-lang/rust/issues/110226.
2023-04-12Add `libLLVM.so` to the target libdir when download-rustc is enabledjyn-4/+5
Previously, we would only add it to the host libdir, which meant it couldn't be loaded by `ui-fulldeps` tests that used rustc_private.
2023-04-12Rollup merge of #110122 - jyn514:check-stage1-llvm, r=ozkanonurMatthias Krüger-70/+78
Fix x check --stage 1 when download-ci-llvm=false Bootstrap tries to avoid building LLVM unless it needs to; in particular we only build it for `x build`, not `x check`. Unfortunately, the check forgot about existence of stages - it would break if you used `x check --stage 1`: ``` = note: /usr/bin/ld: cannot find -lPolly: No such file or directory /usr/bin/ld: cannot find -lPollyISL: No such file or directory ``` Fix it to work for stage 1. I recommend reading this commit-by-commit; the first one makes a bunch of whitespace changes but otherwise doesn't change the logic.
2023-04-10Fix `x check --stage 1` when `download-ci-llvm=false`Joshua Nelson-18/+20
2023-04-10Fix `x test ui --target foo` when download-rustc is enabledJoshua Nelson-3/+3
Previously, we would never build the target std, only the host std.
2023-04-09Separate out a `rustc_llvm_env` functionJoshua Nelson-61/+67
2023-04-03Auto merge of #109884 - matthiaskrgr:rollup-5wapig9, r=matthiaskrgrbors-1/+43
Rollup of 7 pull requests Successful merges: - #109526 (LIBPATH is used as dylib's path environment variable on AIX) - #109642 (check for missing codegen backeng config) - #109722 (Implement read_buf for RustHermit) - #109856 (fix(middle): emit error rather than delay bug when reaching limit) - #109868 (Improve PR job names in Github Actions preview) - #109871 (Include invocation start times) - #109873 (Move some UI tests into subdirectories) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-04-03Rollup merge of #109642 - ↵Matthias Krüger-1/+43
lenko-d:rust_codegen-backends_interacts_confusingly_with_paths, r=Mark-Simulacrum check for missing codegen backeng config Fixes [#109610](https://github.com/rust-lang/rust/issues/109610)
2023-04-03Auto merge of #108288 - ozkanonur:hotfix-90244, r=Mark-Simulacrumbors-0/+7
fix `build --stage 2 compiler/rustc` panic Skip assembling(which causes panic due to not found `.librustc.stamp` file) process for stage3(since it has problems with sysroot) if full-bootstrap isn't used. Resolves #90244
2023-04-02fix `build --stage 2 compiler/rustc` panicozkanonur-0/+7
Signed-off-by: ozkanonur <work@onurozkan.dev>
2023-03-26check for missing codegen backeng configLenko Donchev-1/+43
2023-03-24Rename 'src/bootstrap/native.rs' to llvm.rsRobin Hafid-9/+9
Renamed 'native.rs' to 'llvm.rs', also moved `TestHelpers` to `test.rs`.Replaced all the `native.rs` ocurrences at `src/bootstrap` files to `llvm.rs`
2023-03-12Prevent stable `libtest` from supporting `-Zunstable-options`Thom Chiovoloni-0/+6
2023-02-27Rollup merge of #108308 - bjorn3:faster_bootstrap_build, r=albertlarsan68Matthias Krüger-1/+1
Allow building serde and serde_derive in parallel This reduces build time of bootstrap by ~6s
2023-02-27Allow building serde and serde_derive in parallelbjorn3-1/+1
This reduces build time of bootstrap by ~6s
2023-02-21Revert "Copy `bin/*` and `lib/*.dylib` files to `stage0-sysroot`"Jakub Beránek-66/+0
This reverts commit 6990ab9ad2cde9b67073ffac29ffecc2be8e722f.
2023-02-19Improve building compiler artifacts outputMatthew J Perez-33/+78
2023-02-18Auto merge of #106476 - ↵bors-1/+6
keith:ks/add-sanitizer-support-for-modern-ios-platforms, r=badboy Add sanitizer support for modern iOS platforms asan and tsan generally support iOS, but that previously wasn't configured in rust. This only adds support for the simulator architectures, and arm64 device architecture, not the older 32 bit architectures.
2023-02-17Copy `bin/*` and `lib/*.dylib` files to `stage0-sysroot`KittyBorgX-0/+66
2023-02-12Add sanitizer support for modern iOS platformsKeith Smiley-1/+6
asan and tsan generally support iOS, but that previously wasn't configured in rust. This only adds support for the simulator architectures, and arm64 device architecture, not the older 32 bit architectures.
2023-01-26Add `rust.lto=off` to bootstrapclubby789-0/+10
2023-01-11Change `src/test` to `tests` in source files, fix tidy and testsAlbert Larsan-1/+1
2023-01-04Revert "bootstrap: Get rid of `tail_args` in `stream_cargo`"Joshua Nelson-2/+10
This reverts commit 9dfe50440e6d48bd2fd40a4b7b3992998e55eace. Fixes `x clippy`.
2022-12-31Only include metadata for non-dynamic libraries in rustc-devbjorn3-6/+43
The actual object code should be linked from librustc_driver.so, which is still included in rustc-dev. This saves on download time and disk usage.
2022-12-30bootstrap: Get rid of `tail_args` in `stream_cargo`Joshua Nelson-24/+4
2022-12-30Use more consistent progress messages in bootstrapJoshua Nelson-8/+18
Before: ``` Testing ["rustc_interface"] stage0 (aarch64-unknown-linux-gnu -> aarch64-unknown-linux-gnu) ``` After: ``` Testing {rustc_interface} stage0 (aarch64-unknown-linux-gnu -> aarch64-unknown-linux-gnu) ``` Note there is a slight consistency between `build` and `test`: The former doesn't print "compiler artifacts". It would be annoying to fix and doesn't hurt anything, so I left it be. ``` ; x t rustc_interface --stage 0 --dry-run Testing {rustc_interface} stage0 (aarch64-unknown-linux-gnu -> aarch64-unknown-linux-gnu) ; x b rustc_interface --stage 0 --dry-run Building {rustc_interface} stage0 compiler artifacts (aarch64-unknown-linux-gnu -> aarch64-unknown-linux-gnu) ```
2022-12-29Support `x clean --stage 1 rustc_query_impl`Joshua Nelson-4/+11
Previously, clean only supported `--stage 0` for specific crates. The new `crate_description` function generates a string that looks like ``` : {rustc_query_impl} ```
2022-12-28Skip LTO in stage0 (again)Mark Rousskov-16/+20
2022-12-28delete more `cfg(bootstrap)`Lukas Markeffsky-19/+16
2022-12-26Allow cleaning individual cratesJoshua Nelson-13/+2
As a bonus, this stops special casing `clean` in `Builder`.
2022-12-23Rollup merge of #106051 - jyn514:cranelift-std, r=bjorn3Matthias Krüger-3/+10
Allow building std with cranelift - Don't pass llvm-specific args when using cranelift - Don't use `asm` in compiler_builtins when using cranelift r? `@bjorn3` cc `@Mark-Simulacrum`
2022-12-22Allow building std with craneliftJoshua Nelson-3/+10
- Don't pass llvm-specific args when using cranelift - Don't use `asm` in compiler_builtins when using cranelift
2022-12-22Use LLVM_CMAKE_DIR for lld buildNikita Popov-3/+4
LLVM_CONFIG_PATH is no longer supported as of LLVM 16, switch to using the cmake module instead. We separately return the llvm-config and cmake directory paths, because llvm-config always refers to the host binary, while the cmake directory is for the target triple.
2022-11-19Rollup merge of #104076 - ozkanonur:fix-ci-rustc-sysroot, r=jyn514Matthias Krüger-9/+20
fix sysroot issue which appears for ci downloaded rustc Currently when compiler is downloaded rather than compiled, sysroot is being `ci-rustc-sysroot` because of https://github.com/rust-lang/rust/blob/7eef946fc0e0eff40e588eab77b09b287accbec3/src/bootstrap/compile.rs#L1125-L1131 this. And rustdoc is overriding the downloaded one at the end of the process. With the condition I add, we simply check if the current compiler stage is target build stage, if so use the proper sysroot instead of `ci-rustc-sysroot`. Resolves #103206
2022-11-13Make all download functions need only Config, not BuilderJoshua Nelson-2/+2
This also adds a new `mod download` instead of scattering the download code across `config.rs` and `native.rs`.
2022-11-13Auto merge of #103894 - mati865:gnullvm-libunwind-changes, r=thomccbors-1/+0
Change the way libunwind is linked for *-windows-gnullvm targets I have no idea why previous way works for `x86_64-fortanix-unknown-sgx` (assuming it actually works...) but not for `gnullvm`. It fails when linking libtest during Rust build (unless somebody adds `RUSTFLAGS='-Clinkarg=-lunwind'`). Also fixes exception handling on AArch64.
2022-11-13check if current stage is target build stage r=ozkanonurozkanonur-9/+20
Signed-off-by: ozkanonur <work@onurozkan.dev>
2022-11-12Distinguish `--dry-run` from the automatic dry run checkJoshua Nelson-6/+6
2022-11-01Change the way libunwind is linked for `*-windows-gnullvm` targetsMateusz Mikuła-1/+0
2022-10-29Revert "Make the `c` feature for `compiler-builtins` opt-in instead of inferred"Mark Rousskov-10/+5
This reverts commit 3acb505ee560770c62bad5362f6caf7567d467b9 (PR #101833). The changes in this commit caused several bugs or at least incompatibilies. For now we're reverting this commit and will re-land it alongside fixes for those bugs.
2022-10-23Rollup merge of #103347 - RalfJung:rustc-src, r=Mark-SimulacrumMichael Howell-0/+14
bootstrap: also create rustc-src component in sysroot Fixes https://github.com/rust-lang/rust-analyzer/issues/12926
2022-10-23Introduce dedicated `-Zdylib-lto` flag for enabling LTO on `dylib`sJakub Beránek-0/+22
2022-10-23Add `rust.lto` config optionJakub Beránek-1/+1