Fix build in cross-compilation scenarios
This commit is contained in:
parent
6c2ef5201a
commit
c0253304ea
@ -31,6 +31,7 @@ fn main() {
|
|||||||
// targets, which means we have to build the alloc_jemalloc crate
|
// targets, which means we have to build the alloc_jemalloc crate
|
||||||
// for targets like emscripten, even if we don't use it.
|
// for targets like emscripten, even if we don't use it.
|
||||||
let target = env::var("TARGET").expect("TARGET was not set");
|
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") ||
|
if target.contains("rumprun") || target.contains("bitrig") || target.contains("openbsd") ||
|
||||||
target.contains("msvc") || target.contains("emscripten") || target.contains("fuchsia") ||
|
target.contains("msvc") || target.contains("emscripten") || target.contains("fuchsia") ||
|
||||||
target.contains("redox") {
|
target.contains("redox") {
|
||||||
@ -68,11 +69,10 @@ fn main() {
|
|||||||
} else if !target.contains("windows") && !target.contains("musl") {
|
} else if !target.contains("windows") && !target.contains("musl") {
|
||||||
println!("cargo:rustc-link-lib=pthread");
|
println!("cargo:rustc-link-lib=pthread");
|
||||||
}
|
}
|
||||||
if !cfg!(stage0) {
|
if !cfg!(stage0) && target == host {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let host = env::var("HOST").expect("HOST was not set");
|
|
||||||
let src_dir = env::current_dir().unwrap().join("../jemalloc");
|
let src_dir = env::current_dir().unwrap().join("../jemalloc");
|
||||||
rerun_if_changed_anything_in_dir(&src_dir);
|
rerun_if_changed_anything_in_dir(&src_dir);
|
||||||
let compiler = gcc::Config::new().get_compiler();
|
let compiler = gcc::Config::new().get_compiler();
|
||||||
|
@ -71,7 +71,7 @@ fn build_libbacktrace(host: &str, target: &str) {
|
|||||||
|
|
||||||
println!("cargo:rustc-link-lib=static=backtrace");
|
println!("cargo:rustc-link-lib=static=backtrace");
|
||||||
println!("cargo:rustc-link-search=native={}/.libs", build_dir.display());
|
println!("cargo:rustc-link-search=native={}/.libs", build_dir.display());
|
||||||
if !cfg!(stage0) {
|
if !cfg!(stage0) && target == host {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user