diff --git a/src-tauri/build.rs b/src-tauri/build.rs index ec9a663f..5f3480f0 100644 --- a/src-tauri/build.rs +++ b/src-tauri/build.rs @@ -9,17 +9,22 @@ fn main() { // libsodium-sys-stable uses memset_explicit which isn't available in MinGW let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default(); let target_env = std::env::var("CARGO_CFG_TARGET_ENV").unwrap_or_default(); - + if target_os == "windows" && target_env == "gnu" { + let out_dir = std::env::var("OUT_DIR").unwrap(); + let obj_path = format!("{}/memset_shim.o", out_dir); + cc::Build::new() .file("memset_s_shim.c") .define("WIN32", None) .define("__WIN32__", None) + .out_dir(&out_dir) .compile("memset_shim"); + println!("cargo:rerun-if-changed=memset_s_shim.c"); - // Link the shim library - must be before libsodium in link order - // The shim provides memset_explicit which libsodium expects - println!("cargo:rustc-link-lib=static=memset_shim"); + // Directly link the object file instead of using -l flag + // This ensures the symbol is available regardless of link order + println!("cargo:rustc-link-arg={}", obj_path); } tauri_build::build() diff --git a/src-tauri/src/ollama/installer.rs b/src-tauri/src/ollama/installer.rs index 39f4d795..29673f09 100644 --- a/src-tauri/src/ollama/installer.rs +++ b/src-tauri/src/ollama/installer.rs @@ -52,6 +52,7 @@ pub async fn check_ollama() -> anyhow::Result { } /// Find the full path to the ollama binary +#[allow(dead_code)] fn find_ollama_binary() -> Option { // Try which/where command first let which_cmd = if cfg!(target_os = "windows") {