]> git.lizzy.rs Git - rust.git/commitdiff
Fix build in cross-compilation scenarios
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Sat, 28 Jan 2017 13:05:13 +0000 (16:05 +0300)
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Thu, 2 Feb 2017 19:40:42 +0000 (22:40 +0300)
src/liballoc_jemalloc/build.rs
src/libstd/build.rs

index e08fc75e9ef6afb658b1a972d5b96784e0f8f4c7..c982f98e63defed46d7a506f96f2573723bbb2c5 100644 (file)
@@ -31,6 +31,7 @@ fn main() {
     // targets, which means we have to build the alloc_jemalloc crate
     // for targets like emscripten, even if we don't use it.
     let target = env::var("TARGET").expect("TARGET was not set");
+    let host = env::var("HOST").expect("HOST was not set");
     if target.contains("rumprun") || target.contains("bitrig") || target.contains("openbsd") ||
        target.contains("msvc") || target.contains("emscripten") || target.contains("fuchsia") ||
        target.contains("redox") {
@@ -68,11 +69,10 @@ fn main() {
     } else if !target.contains("windows") && !target.contains("musl") {
         println!("cargo:rustc-link-lib=pthread");
     }
-    if !cfg!(stage0) {
+    if !cfg!(stage0) && target == host {
         return
     }
 
-    let host = env::var("HOST").expect("HOST was not set");
     let src_dir = env::current_dir().unwrap().join("../jemalloc");
     rerun_if_changed_anything_in_dir(&src_dir);
     let compiler = gcc::Config::new().get_compiler();
index faff0d1cb47b53ed16ecf3953a6c47450e9dea36..112e48921cb7384e758e7d04efc51de25564c2b6 100644 (file)
@@ -71,7 +71,7 @@ fn build_libbacktrace(host: &str, target: &str) {
 
     println!("cargo:rustc-link-lib=static=backtrace");
     println!("cargo:rustc-link-search=native={}/.libs", build_dir.display());
-    if !cfg!(stage0) {
+    if !cfg!(stage0) && target == host {
         return
     }