Skip to content

Commit 7748d1c

Browse files
authored
Rollup merge of rust-lang#143752 - pmur:murp/no-panic-detect-wasi-cc, r=Kobzol
Don't panic if WASI_SDK_PATH not set when detecting compiler The fedora packaging builds the wasm sysroot outside of the rust build system. Fedora applies a couple of patches related to wasm which I think make this possible. Not panicking seems consistent with the detection logic of other targets when they cannot find cc.
2 parents 74fd816 + 9bdd3b0 commit 7748d1c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/bootstrap/src/utils/cc_detect.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,15 @@ fn default_compiler(
220220
}
221221

222222
t if t.contains("-wasi") => {
223-
let root = build
224-
.wasi_sdk_path
225-
.as_ref()
226-
.expect("WASI_SDK_PATH mut be configured for a -wasi target");
223+
let root = if let Some(path) = build.wasi_sdk_path.as_ref() {
224+
path
225+
} else {
226+
if build.config.is_running_on_ci {
227+
panic!("ERROR: WASI_SDK_PATH must be configured for a -wasi target on CI");
228+
}
229+
println!("WARNING: WASI_SDK_PATH not set, using default cc/cxx compiler");
230+
return None;
231+
};
227232
let compiler = match compiler {
228233
Language::C => format!("{t}-clang"),
229234
Language::CPlusPlus => format!("{t}-clang++"),

0 commit comments

Comments
 (0)