Skip to content

Commit c025330

Browse files
committed
Fix build in cross-compilation scenarios
1 parent 6c2ef52 commit c025330

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/liballoc_jemalloc/build.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ fn main() {
3131
// targets, which means we have to build the alloc_jemalloc crate
3232
// for targets like emscripten, even if we don't use it.
3333
let target = env::var("TARGET").expect("TARGET was not set");
34+
let host = env::var("HOST").expect("HOST was not set");
3435
if target.contains("rumprun") || target.contains("bitrig") || target.contains("openbsd") ||
3536
target.contains("msvc") || target.contains("emscripten") || target.contains("fuchsia") ||
3637
target.contains("redox") {
@@ -68,11 +69,10 @@ fn main() {
6869
} else if !target.contains("windows") && !target.contains("musl") {
6970
println!("cargo:rustc-link-lib=pthread");
7071
}
71-
if !cfg!(stage0) {
72+
if !cfg!(stage0) && target == host {
7273
return
7374
}
7475

75-
let host = env::var("HOST").expect("HOST was not set");
7676
let src_dir = env::current_dir().unwrap().join("../jemalloc");
7777
rerun_if_changed_anything_in_dir(&src_dir);
7878
let compiler = gcc::Config::new().get_compiler();

src/libstd/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ fn build_libbacktrace(host: &str, target: &str) {
7171

7272
println!("cargo:rustc-link-lib=static=backtrace");
7373
println!("cargo:rustc-link-search=native={}/.libs", build_dir.display());
74-
if !cfg!(stage0) {
74+
if !cfg!(stage0) && target == host {
7575
return
7676
}
7777

0 commit comments

Comments
 (0)