Rollup merge of #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.
This commit is contained in:
Samuel Tardieu 2025-07-15 12:52:38 +02:00 committed by GitHub
commit 6b6c8be19d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -220,10 +220,15 @@ fn default_compiler(
}
t if t.contains("-wasi") => {
let root = build
.wasi_sdk_path
.as_ref()
.expect("WASI_SDK_PATH mut be configured for a -wasi target");
let root = if let Some(path) = build.wasi_sdk_path.as_ref() {
path
} else {
if build.config.is_running_on_ci {
panic!("ERROR: WASI_SDK_PATH must be configured for a -wasi target on CI");
}
println!("WARNING: WASI_SDK_PATH not set, using default cc/cxx compiler");
return None;
};
let compiler = match compiler {
Language::C => format!("{t}-clang"),
Language::CPlusPlus => format!("{t}-clang++"),