Skip to content

Commit a3a4c7c

Browse files
authored
Rollup merge of rust-lang#61890 - golddranks:fix_sanity_check_llvm, r=Dylan-DPC
Fix some sanity checks Update: Changes that made it not to work dropped. * Fix `building_llvm` in sanity check * This was subtly broken: we build LLVM if any of the hosts builds LLVM, and not setting the config meant that LLVM is built for that target. Because of filtering away the targets not configured and the semantics of `Iterator::any`, it currently didn't set the `building_llvm` flag even if we indeed build it. * Add `swig` sanity check * This checks whether there is a `swig` executable needed for LLDB.
2 parents 49e111a + f78cd4d commit a3a4c7c

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/bootstrap/sanity.rs

+13-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,11 @@ pub fn check(build: &mut Build) {
7878

7979
// We need cmake, but only if we're actually building LLVM or sanitizers.
8080
let building_llvm = build.hosts.iter()
81-
.filter_map(|host| build.config.target_config.get(host))
82-
.any(|config| config.llvm_config.is_none());
81+
.map(|host| build.config.target_config
82+
.get(host)
83+
.map(|config| config.llvm_config.is_none())
84+
.unwrap_or(true))
85+
.any(|build_llvm_ourselves| build_llvm_ourselves);
8386
if building_llvm || build.config.sanitizers {
8487
cmd_finder.must_have("cmake");
8588
}
@@ -106,6 +109,14 @@ pub fn check(build: &mut Build) {
106109
build.config.ninja = true;
107110
}
108111
}
112+
113+
if build.config.lldb_enabled {
114+
cmd_finder.must_have("swig");
115+
let out = output(Command::new("swig").arg("-version"));
116+
if !out.contains("SWIG Version 3") && !out.contains("SWIG Version 4") {
117+
panic!("Ensure that Swig 3.x.x or 4.x.x is installed.");
118+
}
119+
}
109120
}
110121

111122
build.config.python = build.config.python.take().map(|p| cmd_finder.must_have(p))

0 commit comments

Comments
 (0)