Merge pull request 'fix(windows): link memset_shim object directly and suppress dead_code warning' (#120) from fix/cargo-config-sodium into beta
Some checks failed
Release Beta / autotag (push) Successful in 10s
Release Beta / changelog (push) Successful in 1m34s
Test / frontend-tests (push) Successful in 1m46s
Test / frontend-typecheck (push) Successful in 1m53s
Release Beta / build-linux-amd64 (push) Successful in 10m47s
Release Beta / build-windows-amd64 (push) Failing after 11m7s
Release Beta / build-linux-arm64 (push) Successful in 13m29s
Test / rust-fmt-check (push) Successful in 18m18s
Test / rust-clippy (push) Successful in 19m40s
Release Beta / build-macos-arm64 (push) Failing after 20m38s
Test / rust-tests (push) Successful in 21m36s

Reviewed-on: #120
This commit is contained in:
sarman 2026-06-19 16:52:55 +00:00
commit 0c5d06c4e9
2 changed files with 10 additions and 4 deletions

View File

@ -9,17 +9,22 @@ fn main() {
// libsodium-sys-stable uses memset_explicit which isn't available in MinGW // 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_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
let target_env = std::env::var("CARGO_CFG_TARGET_ENV").unwrap_or_default(); let target_env = std::env::var("CARGO_CFG_TARGET_ENV").unwrap_or_default();
if target_os == "windows" && target_env == "gnu" { 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() cc::Build::new()
.file("memset_s_shim.c") .file("memset_s_shim.c")
.define("WIN32", None) .define("WIN32", None)
.define("__WIN32__", None) .define("__WIN32__", None)
.out_dir(&out_dir)
.compile("memset_shim"); .compile("memset_shim");
println!("cargo:rerun-if-changed=memset_s_shim.c"); println!("cargo:rerun-if-changed=memset_s_shim.c");
// Link the shim library - must be before libsodium in link order // Directly link the object file instead of using -l flag
// The shim provides memset_explicit which libsodium expects // This ensures the symbol is available regardless of link order
println!("cargo:rustc-link-lib=static=memset_shim"); println!("cargo:rustc-link-arg={}", obj_path);
} }
tauri_build::build() 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 /// Find the full path to the ollama binary
#[allow(dead_code)]
fn find_ollama_binary() -> Option<std::path::PathBuf> { fn find_ollama_binary() -> Option<std::path::PathBuf> {
// Try which/where command first // Try which/where command first
let which_cmd = if cfg!(target_os = "windows") { let which_cmd = if cfg!(target_os = "windows") {