From a274da62d33449769653f698aad92142d3afa627 Mon Sep 17 00:00:00 2001 From: Folkert Date: Tue, 30 Aug 2022 14:27:16 +0200 Subject: [PATCH] use the windows builtins .obj when cross-compiling --- crates/compiler/build/src/link.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/compiler/build/src/link.rs b/crates/compiler/build/src/link.rs index 536b655a69..29bfbcf15a 100644 --- a/crates/compiler/build/src/link.rs +++ b/crates/compiler/build/src/link.rs @@ -121,11 +121,20 @@ pub fn build_zig_host_native( .env("HOME", env_home); if let Some(shared_lib_path) = shared_lib_path { + // with LLVM, the builtins are already part of the roc app, + // but with the dev backend, they are missing. To minimize work, + // we link them as part of the host executable + let builtins_obj = if target.contains("windows") { + bitcode::get_builtins_windows_obj_path() + } else { + bitcode::get_builtins_host_obj_path() + }; + command.args(&[ "build-exe", "-fPIE", shared_lib_path.to_str().unwrap(), - &bitcode::get_builtins_host_obj_path(), + &builtins_obj, ]); } else { command.args(&["build-obj", "-fPIC"]);