Skip to content

Commit 3ccb87a

Browse files
committed
liballoc_jemalloc: fix linking with system library
1 parent 5de2a24 commit 3ccb87a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/liballoc_jemalloc/build.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ fn main() {
4242
return;
4343
}
4444

45+
if target.contains("android") {
46+
println!("cargo:rustc-link-lib=gcc");
47+
} else if !target.contains("windows") && !target.contains("musl") {
48+
println!("cargo:rustc-link-lib=pthread");
49+
}
50+
4551
if let Some(jemalloc) = env::var_os("JEMALLOC_OVERRIDE") {
4652
let jemalloc = PathBuf::from(jemalloc);
4753
println!("cargo:rustc-link-search=native={}",
@@ -176,11 +182,6 @@ fn main() {
176182
println!("cargo:rustc-link-lib=static=jemalloc_pic");
177183
}
178184
println!("cargo:rustc-link-search=native={}/lib", build_dir.display());
179-
if target.contains("android") {
180-
println!("cargo:rustc-link-lib=gcc");
181-
} else if !target.contains("windows") && !target.contains("musl") {
182-
println!("cargo:rustc-link-lib=pthread");
183-
}
184185

185186
// The pthread_atfork symbols is used by jemalloc on android but the really
186187
// old android we're building on doesn't have them defined, so just make

0 commit comments

Comments
 (0)