From 781561a6f26008a49572e156f80b577d6af60262 Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Fri, 3 Feb 2017 16:15:34 +0900 Subject: [PATCH] liballoc_jemalloc: fix linking with system library --- src/liballoc_jemalloc/build.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/liballoc_jemalloc/build.rs b/src/liballoc_jemalloc/build.rs index 1143df0c63..297f5ce99f 100644 --- a/src/liballoc_jemalloc/build.rs +++ b/src/liballoc_jemalloc/build.rs @@ -42,6 +42,12 @@ fn main() { return; } + if target.contains("android") { + println!("cargo:rustc-link-lib=gcc"); + } else if !target.contains("windows") && !target.contains("musl") { + println!("cargo:rustc-link-lib=pthread"); + } + if let Some(jemalloc) = env::var_os("JEMALLOC_OVERRIDE") { let jemalloc = PathBuf::from(jemalloc); println!("cargo:rustc-link-search=native={}", @@ -176,11 +182,6 @@ fn main() { println!("cargo:rustc-link-lib=static=jemalloc_pic"); } println!("cargo:rustc-link-search=native={}/lib", build_dir.display()); - if target.contains("android") { - println!("cargo:rustc-link-lib=gcc"); - } else if !target.contains("windows") && !target.contains("musl") { - println!("cargo:rustc-link-lib=pthread"); - } // The pthread_atfork symbols is used by jemalloc on android but the really // old android we're building on doesn't have them defined, so just make -- 2.12.0