fix(windows): add memset_explicit symbol export for mingw cross-compilation #118

Merged
sarman merged 2 commits from fix/cargo-config-sodium into beta 2026-06-19 04:39:01 +00:00
Owner
  • Add __declspec(dllexport) to memset_explicit in memset_s_shim.c
  • Explicitly link memset_shim library in build.rs for Windows MinGW target
  • Fixes undefined reference to memset_explicit when building for x86_64-pc-windows-gnu
- Add __declspec(dllexport) to memset_explicit in memset_s_shim.c - Explicitly link memset_shim library in build.rs for Windows MinGW target - Fixes undefined reference to memset_explicit when building for x86_64-pc-windows-gnu
sarman added 1 commit 2026-06-19 04:33:09 +00:00
fix(windows): add memset_explicit symbol export for mingw cross-compilation
Some checks failed
Test / frontend-typecheck (pull_request) Successful in 1m57s
Test / rust-clippy (pull_request) Has been cancelled
Test / rust-fmt-check (pull_request) Has been cancelled
Test / frontend-tests (pull_request) Successful in 1m46s
PR Review Automation / review (pull_request) Successful in 4m30s
Test / rust-tests (pull_request) Has been cancelled
d45e767d6d
- Add __declspec(dllexport) to memset_explicit in memset_s_shim.c
- Explicitly link memset_shim library in build.rs for Windows MinGW target
- Fixes undefined reference to memset_explicit when building for x86_64-pc-windows-gnu
sarman reviewed 2026-06-19 04:37:37 +00:00
sarman left a comment
Author
Owner

Automated PR Review (qwen3.5-122b-think via liteLLM):\n\n

Summary

This PR addresses a Windows MinGW cross-compilation issue by adding a memset_explicit shim library. The changes compile a C static library and link it explicitly when targeting Windows GNU. The implementation is straightforward and addresses the stated problem of undefined references during MinGW builds.

Findings

  • [SUGGESTION] src-tauri/build.rs:14 - __declspec(dllexport) is unnecessary for static libraries
    Evidence: #define EXPORT __declspec(dllexport) in memset_s_shim.c
    Fix: Remove the EXPORT macro usage or use it conditionally only for DLL builds. For static libraries on Windows, symbols are exported by default without this directive. This is not a functional bug but follows best practices.

  • [SUGGESTION] src-tauri/build.rs:11 - Build script could benefit from error handling
    Evidence: cc::Build::new().file("memset_s_shim.c").compile("memset_shim"); has no error handling
    Fix: Consider adding .compile("memset_shim") return value checking or letting cc crate handle errors (current behavior is acceptable as cc will panic on failure anyway).

Verdict: APPROVE WITH COMMENTS

The code will compile and function correctly. The __declspec(dllexport) on a static library is harmless but unnecessary - it's commonly ignored by linkers for static libs. The fix addresses the core issue of missing memset_explicit symbol for libsodium-sys-stable on MinGW targets. The changes are minimal and targeted appropriately.

Automated PR Review (qwen3.5-122b-think via liteLLM):\n\n **Summary** This PR addresses a Windows MinGW cross-compilation issue by adding a `memset_explicit` shim library. The changes compile a C static library and link it explicitly when targeting Windows GNU. The implementation is straightforward and addresses the stated problem of undefined references during MinGW builds. **Findings** - [SUGGESTION] src-tauri/build.rs:14 - `__declspec(dllexport)` is unnecessary for static libraries Evidence: `#define EXPORT __declspec(dllexport)` in memset_s_shim.c Fix: Remove the `EXPORT` macro usage or use it conditionally only for DLL builds. For static libraries on Windows, symbols are exported by default without this directive. This is not a functional bug but follows best practices. - [SUGGESTION] src-tauri/build.rs:11 - Build script could benefit from error handling Evidence: `cc::Build::new().file("memset_s_shim.c").compile("memset_shim");` has no error handling Fix: Consider adding `.compile("memset_shim")` return value checking or letting `cc` crate handle errors (current behavior is acceptable as `cc` will panic on failure anyway). **Verdict**: APPROVE WITH COMMENTS The code will compile and function correctly. The `__declspec(dllexport)` on a static library is harmless but unnecessary - it's commonly ignored by linkers for static libs. The fix addresses the core issue of missing `memset_explicit` symbol for libsodium-sys-stable on MinGW targets. The changes are minimal and targeted appropriately.
sarman added 1 commit 2026-06-19 04:38:40 +00:00
Merge branch 'beta' into fix/cargo-config-sodium
Some checks failed
PR Review Automation / review (pull_request) Has been cancelled
Test / frontend-typecheck (pull_request) Has been cancelled
Test / frontend-tests (pull_request) Has been cancelled
Test / rust-clippy (pull_request) Has been cancelled
Test / rust-tests (pull_request) Has been cancelled
Test / rust-fmt-check (pull_request) Has been cancelled
5cd2e08f92
sarman merged commit cf1dffb32b into beta 2026-06-19 04:39:01 +00:00
sarman deleted branch fix/cargo-config-sodium 2026-06-19 04:39:02 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sarman/tftsr-devops_investigation#118
No description provided.