From 517b7b5a47ff7b989ce9dfa67a738d9e002b8336 Mon Sep 17 00:00:00 2001 From: Adenilson Cavalcanti Date: Tue, 16 Jun 2015 15:46:23 -0700 Subject: [PATCH 1/2] Fix build on Raspberry Pi2. As the debian based linux distro uses 'alternatives' to allow selecting tools (i.e. compiler), hardcoding the CC compiler to arm-linux-gnueabihf-gcc may not point to the user selected default compiler. After discussion, it makes sense to only set the tools if you are crosscompiling. --- png-sys/build.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/png-sys/build.rs b/png-sys/build.rs index 6a431ba..5331bf3 100644 --- a/png-sys/build.rs +++ b/png-sys/build.rs @@ -7,12 +7,13 @@ use std::process::Stdio; fn main() { let target = env::var("TARGET").unwrap(); let host = env::var("HOST").unwrap(); - let is_target_embedded = target.find("eabi").is_some(); - if is_target_embedded { + if host != target { let cc = format!("{}-gcc", target); let ar = format!("{}-ar", target); let ranlib = format!("{}-ranlib", target); + // This will break raspbian as it provides gcc/etc through + // alternatives (https://wiki.debian.org/DebianAlternative). env::set_var("CC", &cc); env::set_var("AR", &ar); env::set_var("RANLIB", &ranlib); @@ -37,7 +38,7 @@ fn main() { } else { cmd = Command::new(cfg); cmd.arg("--with-libpng-prefix=RUST_"); - if is_target_embedded { + if host != target { cmd.arg(format!("--host={}", target)); } } From 42c92c830bdd08fffb468f92f4632b258047e54a Mon Sep 17 00:00:00 2001 From: Adenilson Cavalcanti Date: Wed, 17 Jun 2015 15:54:25 -0700 Subject: [PATCH 2/2] Fixing URL (addresses reviewing request). --- png-sys/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/png-sys/build.rs b/png-sys/build.rs index 5331bf3..223ccf8 100644 --- a/png-sys/build.rs +++ b/png-sys/build.rs @@ -13,7 +13,7 @@ fn main() { let ar = format!("{}-ar", target); let ranlib = format!("{}-ranlib", target); // This will break raspbian as it provides gcc/etc through - // alternatives (https://wiki.debian.org/DebianAlternative). + // alternatives (https://wiki.debian.org/DebianAlternatives). env::set_var("CC", &cc); env::set_var("AR", &ar); env::set_var("RANLIB", &ranlib);