1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
From: Paul Murphy <paumurph@redhat.com>
Date: Thu, 10 Jul 2025 10:58:58 -0500
Subject: 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.
(cherry picked from commit 9bdd3b0ee6a6fd5914fea0f56f3b754410733e53)
Forwarded: not-needed
---
src/bootstrap/src/utils/cc_detect.rs | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/bootstrap/src/utils/cc_detect.rs b/src/bootstrap/src/utils/cc_detect.rs
index dcafeb8..2569f95 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++"),
|