diff options
| author | Paul Murphy <paumurph@redhat.com> | 2025-07-10 10:58:58 -0500 |
|---|---|---|
| committer | Paul Murphy <paumurph@redhat.com> | 2025-07-14 15:05:59 -0500 |
| commit | 9bdd3b0ee6a6fd5914fea0f56f3b754410733e53 (patch) | |
| tree | 73086dcaa165ec4a05f267c3f492810af23f62f3 | |
| parent | 25cf7d13c960a3ac47d1424ca354077efb6946ff (diff) | |
| download | rust-9bdd3b0ee6a6fd5914fea0f56f3b754410733e53.tar.gz rust-9bdd3b0ee6a6fd5914fea0f56f3b754410733e53.zip | |
Don't always panic if WASI_SDK_PATH is not set when detecting compilers
They are not always needed when building std, as is the case when packaging on Fedora. Panic if building from CI, but warn otherwise.
| -rw-r--r-- | src/bootstrap/src/utils/cc_detect.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/bootstrap/src/utils/cc_detect.rs b/src/bootstrap/src/utils/cc_detect.rs index dcafeb80f90..2569f95e3ef 100644 --- a/src/bootstrap/src/utils/cc_detect.rs +++ b/src/bootstrap/src/utils/cc_detect.rs @@ -221,10 +221,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++"), |
