Skip to content

Commit 525abaf

Browse files
committed
Fix unwrap on compiler names without -
1 parent 3cdf73b commit 525abaf

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

build.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,12 @@ fn build() -> io::Result<()> {
207207
let cc = cc::Build::new();
208208
let compiler = cc.get_compiler();
209209
let compiler = compiler.path().file_stem().unwrap().to_str().unwrap();
210-
let suffix_pos = compiler.rfind('-').unwrap(); // cut off "-gcc"
211-
let prefix = compiler[0..suffix_pos].trim_end_matches("-wr"); // "wr-c++" compiler
210+
if let Some(suffix_pos) = compiler.rfind('-') {
211+
// cut off "-gcc"
212+
let prefix = compiler[0..suffix_pos].trim_end_matches("-wr"); // "wr-c++" compiler
213+
configure.arg(format!("--cross-prefix={}-", prefix));
214+
}
212215

213-
configure.arg(format!("--cross-prefix={}-", prefix));
214216
configure.arg(format!(
215217
"--arch={}",
216218
env::var("CARGO_CFG_TARGET_ARCH").unwrap()

0 commit comments

Comments
 (0)