Skip to content

Commit 873de7e

Browse files
authored
Rollup merge of #123642 - onur-ozkan:restrict-llvm-option, r=Mark-Simulacrum
do not allow using local llvm while using rustc from ci From: #123586 (comment) > Even if `llvm.download-ci-llvm` is set to true, `stage > 0` rustc will always use the prebuilt LLVM library which comes with ci-rustc. So I tried to use locally-built LLVM libraries in the ci-rustc by replacing the existing LLVM libraries with the locally built ones, and it appears that this is indeed a limitation of using `rust.download-rustc=true` as it fails with the following error: > > ``` > $ ./build/host/ci-rustc/bin/rustc --version > ./build/host/ci-rustc/bin/rustc: symbol lookup error: /home/nimda/devspace/.other/rustc-builds/build/x86_64-unknown-linux-gnu/ci-rustc/bin/../lib/librustc_driver-a03ea465d8e03db1.so: undefined symbol: LLVMInitializeARMTargetInfo, version LLVM_18.1 > ``` > > So, if `rust.download-rustc` is set to true and `llvm.download-ci-llvm` is false, I believe bootstrap should terminate the process (as it always uses prebuilt LLVM libraries from ci-rustc, there is no point to build LLVM locally) while parsing the configuration. Resolves #123586 r? Mark-Simulacrum
2 parents 7a69120 + a7aa7fd commit 873de7e

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

config.example.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
#
5151
# Note that many of the LLVM options are not currently supported for
5252
# downloading. Currently only the "assertions" option can be toggled.
53-
#download-ci-llvm = if rust.channel == "dev" { "if-unchanged" } else { false }
53+
#download-ci-llvm = if rust.channel == "dev" || rust.download-rustc != false { "if-unchanged" } else { false }
5454

5555
# Indicates whether the LLVM build is a Release or Debug build
5656
#optimize = true

src/bootstrap/src/core/config/config.rs

+13-2
Original file line numberDiff line numberDiff line change
@@ -2483,9 +2483,20 @@ impl Config {
24832483
llvm::is_ci_llvm_available(self, asserts)
24842484
}
24852485
};
2486+
24862487
match download_ci_llvm {
2487-
None => self.channel == "dev" && if_unchanged(),
2488-
Some(StringOrBool::Bool(b)) => b,
2488+
None => {
2489+
(self.channel == "dev" || self.download_rustc_commit.is_some()) && if_unchanged()
2490+
}
2491+
Some(StringOrBool::Bool(b)) => {
2492+
if !b && self.download_rustc_commit.is_some() {
2493+
panic!(
2494+
"`llvm.download-ci-llvm` cannot be set to `false` if `rust.download-rustc` is set to `true` or `if-unchanged`."
2495+
);
2496+
}
2497+
2498+
b
2499+
}
24892500
// FIXME: "if-available" is deprecated. Remove this block later (around mid 2024)
24902501
// to not break builds between the recent-to-old checkouts.
24912502
Some(StringOrBool::String(s)) if s == "if-available" => {

0 commit comments

Comments
 (0)