From ffc397d143bf6f046d2e9bd0b7c9239f0b8e926f Mon Sep 17 00:00:00 2001 From: Jeff Waugh Date: Fri, 21 Oct 2016 06:01:18 +1100 Subject: [PATCH] Trim right - from CROSS_COMPILE Note the expected form of CROSS_COMPILE for future reference. --- src/lib.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 7bfda51..4750a1d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -713,8 +713,10 @@ impl Config { } else if target.contains("android") { format!("{}-{}", target, gnu) } else if self.get_host() != target { - let cross_compile = self.getenv("CROSS_COMPILE"); - let prefix = cross_compile.as_ref().map(String::as_str).or(match &target[..] { + // CROSS_COMPILE is of the form: "arm-linux-gnueabi-" + let cc_env = self.getenv("CROSS_COMPILE"); + let cross_compile = cc_env.as_ref().map(|s| s.trim_right_matches('-')); + let prefix = cross_compile.or(match &target[..] { "aarch64-unknown-linux-gnu" => Some("aarch64-linux-gnu"), "arm-unknown-linux-gnueabi" => Some("arm-linux-gnueabi"), "arm-unknown-linux-gnueabihf" => Some("arm-linux-gnueabihf"),