about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2025-07-15 12:52:38 +0200
committerGitHub <noreply@github.com>2025-07-15 12:52:38 +0200
commit6b6c8be19d91b659e523d0c3f400bc54bc6300cb (patch)
tree6b739a2787730be14722a25802d87f799dd5b747
parente66f26fb744a8af393c1299ee20565f4b425f563 (diff)
parent9bdd3b0ee6a6fd5914fea0f56f3b754410733e53 (diff)
downloadrust-6b6c8be19d91b659e523d0c3f400bc54bc6300cb.tar.gz
rust-6b6c8be19d91b659e523d0c3f400bc54bc6300cb.zip
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.
-rw-r--r--src/bootstrap/src/utils/cc_detect.rs13
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 778591189a3..d3926df9650 100644
--- a/src/bootstrap/src/utils/cc_detect.rs
+++ b/src/bootstrap/src/utils/cc_detect.rs
@@ -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++"),