From 52edfd60106d68f2ee4c6d1b154575015398cdf0 Mon Sep 17 00:00:00 2001 From: Kornel Date: Mon, 22 Nov 2021 01:43:58 +0000 Subject: [PATCH] Explicitly enable cross-compilation in ./configure --- sys/build.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/build.rs b/sys/build.rs index 68b1ce3..3615363 100644 --- a/sys/build.rs +++ b/sys/build.rs @@ -196,7 +196,11 @@ fn build(target_os: &str) -> io::Result<()> { configure.arg(format!("--prefix={}", search().to_string_lossy())); - if env::var("TARGET").unwrap() != env::var("HOST").unwrap() { + let target = env::var("TARGET").unwrap(); + let host = env::var("HOST").unwrap(); + if target != host { + configure.arg("--enable-cross-compile"); + // Rust targets are subtly different than naming scheme for compiler prefixes. // The cc crate has the messy logic of guessing a working prefix, // and this is a messy way of reusing that logic.