fix(windows): compile memset_shim to real .o via get_compiler() #121
No reviewers
Labels
No Label
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sarman/tftsr-devops_investigation#121
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/cargo-config-sodium"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
compile("memset_shim")createslibmemset_shim.abut the previous code passedOUT_DIR/memset_shim.oto the linker — a file that never exists, causing theld: cannot finderrorcc::Build::new().get_compiler().to_command()to compilememset_s_shim.cdirectly to a.ofile at a knownOUT_DIRpath-lflags only pull symbols that are already undefined at that point in the link)Test plan
x86_64-pc-windows-gnutarget)memset_explicitsymbol is resolved at link time (no undefined symbol error)target_os == "windows" && target_env == "gnu")compile("memset_shim") produces libmemset_shim.a, not memset_shim.o, so the previous cargo:rustc-link-arg pointed at a file that never exists. Switching to get_compiler().to_command() compiles memset_s_shim.c directly to a .o file at a known OUT_DIR path and passes it as a positional linker arg. A positional .o is always included unconditionally, which also resolves the archive-extraction ordering issue where -l flags only pull symbols that are already undefined at that point in the link command.Automated PR Review (qwen3.5-122b-think via liteLLM):\n\n
Summary
The PR addresses a Windows MinGW linking issue by compiling the memset shim directly to an object file instead of using
compile(). However, there's a significant concern about cross-compilation configuration that could cause the build to fail on Windows targets.Findings
[WARNING] src-tauri/build.rs:27 - Cross-compilation compiler may not be properly configured for MinGW
Evidence:
let compiler = cc::Build::new().get_compiler();The
cc::Buildstruct is not configured with the target triple or compiler for MinGW cross-compilation. When building forx86_64-pc-windows-gnu, the compiler should bex86_64-w64-mingw32-gcc, butget_compiler()may return the host compiler instead. Thecccrate respects environment variables likeCC_x86_64_pc_windows_gnu, but only ifBuild::target()is properly set.Fix: Configure the
cc::Buildwith the target before getting the compiler:Or better, use the
cccrate's build method which handles cross-compilation automatically:[SUGGESTION] src-tauri/build.rs:27 - Error handling could be more informative
Evidence:
.expect("failed to invoke C compiler for memset_s_shim.c");While not a blocker, adding more context to the error message (like the actual command or stderr output) would help debug cross-compilation issues.
Verdict: APPROVE WITH COMMENTS
The PR addresses the core issue correctly (using positional object files instead of static library), but the cross-compilation configuration should be verified. The
cccrate typically handles target detection via environment variables, so this may work in practice, but explicit configuration would be more robust.