We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 76c821e commit 00befe7Copy full SHA for 00befe7
src/lib.rs
@@ -2605,12 +2605,17 @@ impl Build {
2605
} else if self.get_host()? != target {
2606
match self.prefix_for_target(&target) {
2607
Some(p) => {
2608
- let target_ar = format!("{}-gcc-ar", p);
2609
- if Command::new(&target_ar).output().is_ok() {
2610
- target_ar
2611
- } else {
2612
- default_ar
+ // GCC uses $target-gcc-ar, whereas binutils uses $target-ar -- try both.
+ // Prefer -gcc-ar if it exists, since that matches what we'll use for $CC.
+ let mut ar = default_ar;
+ for &infix in &["-gcc", ""] {
+ let target_ar = format!("{}{}-ar", p, infix);
2613
+ if Command::new(&target_ar).output().is_ok() {
2614
+ ar = target_ar;
2615
+ break;
2616
+ }
2617
}
2618
+ ar
2619
2620
None => default_ar,
2621
0 commit comments