From 57e3a7b2ca5837677c7198d47207d6e15eaa7a73 Mon Sep 17 00:00:00 2001 From: Valeriy Kosikhin Date: Mon, 17 Nov 2025 15:17:25 +0300 Subject: [PATCH] fix(loader): set correct runtime host for cc while cross-compiling Pass the BUILD_TARGET variable from the build environment as 'host' for the cc crate. Otherwise, when cross-compiled, cc will keep looking for a cross-compiler instead of the native one on the target system. Signed-off-by: Valeriy Kosikhin --- crates/loader/src/loader.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/loader/src/loader.rs b/crates/loader/src/loader.rs index 08d6af84..cf2c1a77 100644 --- a/crates/loader/src/loader.rs +++ b/crates/loader/src/loader.rs @@ -557,7 +557,6 @@ impl Config { } const BUILD_TARGET: &str = env!("BUILD_TARGET"); -const BUILD_HOST: &str = env!("BUILD_HOST"); pub struct LanguageConfiguration<'a> { pub scope: Option, @@ -1107,7 +1106,10 @@ impl Loader { .cargo_metadata(false) .cargo_warnings(false) .target(BUILD_TARGET) - .host(BUILD_HOST) + // BUILD_TARGET from the build environment becomes a runtime host for cc. + // Otherwise, when cross compiled, cc will keep looking for a cross-compiler + // on the target system instead of the native compiler. + .host(BUILD_TARGET) .debug(self.debug_build) .file(&config.parser_path) .includes(&config.header_paths)