fix(windows): link memset_shim object directly and suppress dead_code warning #120

Merged
sarman merged 1 commits from fix/cargo-config-sodium into beta 2026-06-19 16:52:57 +00:00
2 changed files with 10 additions and 4 deletions

View File

@ -11,15 +11,20 @@ fn main() {
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()

View File

@ -52,6 +52,7 @@ pub async fn check_ollama() -> anyhow::Result<OllamaStatus> {
}
/// Find the full path to the ollama binary
#[allow(dead_code)]
fn find_ollama_binary() -> Option<std::path::PathBuf> {
// Try which/where command first
let which_cmd = if cfg!(target_os = "windows") {