Skip to content

fix: patch whisper-rs-sys for Windows MSVC static CRT#276

Merged
graycyrus merged 1 commit intotinyhumansai:mainfrom
sanil-23:fix/whisper-windows-build
Apr 2, 2026
Merged

fix: patch whisper-rs-sys for Windows MSVC static CRT#276
graycyrus merged 1 commit intotinyhumansai:mainfrom
sanil-23:fix/whisper-windows-build

Conversation

@sanil-23
Copy link
Copy Markdown
Contributor

@sanil-23 sanil-23 commented Apr 2, 2026

Summary

Problem

  • whisper-rs-sys builds whisper.cpp via CMake which defaults to /MD (dynamic CRT)
  • All other C dependencies and Rust itself use /MT (static CRT) on Windows MSVC
  • Linker fails with LNK2038: mismatch detected for 'RuntimeLibrary' and LNK1169: multiply defined symbols
  • Blocks all Windows development and testing on main

Solution

  • Fork whisper-rs-sys to tinyhumansai/whisper-rs-sys with one change: call config.static_crt(true) in build.rs and override all per-config CMake flags (Debug/Release/MinSizeRel/RelWithDebInfo) from /MD to /MT
  • Add [patch.crates-io] in Cargo.toml pointing to the fork

Submission Checklist

  • Unit tests — N/A (build fix only, no code changes)
  • E2E / integration — Verified: cargo build --bin openhuman-core succeeds on Windows MSVC where it previously failed
  • Doc comments — Comment in Cargo.toml explaining the patch
  • Inline comments — N/A

Impact

  • Windows: Build unblocked. No runtime behavior change — same whisper.cpp, just linked with /MT instead of /MD
  • Linux/macOS: No effect — the static_crt call is gated behind #[cfg(target_env = "msvc")]

Related

Summary by CodeRabbit

  • Chores
    • Updated dependency configuration to use an alternative source for a core library component, enabling access to the latest development version.

The upstream whisper-rs-sys builds whisper.cpp via CMake which
defaults to /MD (dynamic CRT), but Rust and all other C deps
use /MT (static CRT). This causes LNK2038/LNK1169 linker errors
on Windows.

Patch whisper-rs-sys from tinyhumansai/whisper-rs-sys fork which
adds config.static_crt(true) and overrides all per-config CMake
flags (Debug/Release/MinSizeRel/RelWithDebInfo) from /MD to /MT.

Closes tinyhumansai#273
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 2, 2026

📝 Walkthrough

Walkthrough

The pull request adds a Cargo patch override that redirects the whisper-rs-sys crate dependency to a Git repository on the main branch. This allows the project to use a custom or fixed version of the whisper-rs-sys crate instead of the published version.

Changes

Cohort / File(s) Summary
Cargo Patch Override
Cargo.toml
Added [patch.crates-io] section to replace whisper-rs-sys dependency with Git source from https://github.com/tinyhumansai/whisper-rs-sys.git on the main branch.

Possibly related issues

Poem

🐰 A patch applied with gentle paws,
To whisper-rs-sys without pause,
From Git's main branch, we now compile,
Windows CRT troubles, begone—with style! ✨

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: patch whisper-rs-sys for Windows MSVC static CRT' is a short, clear, and specific description of the main change in the PR—adding a patch override for whisper-rs-sys to fix Windows MSVC build issues.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Cargo.toml`:
- Around line 130-131: The patch entry for whisper-rs-sys is using a floating
branch; replace the branch reference with the immutable commit currently in the
lockfile by changing the dependency spec for whisper-rs-sys to use rev =
"229cb4c97e41ca302d3f13b1fa7e93a9b417a5f9" (i.e., whisper-rs-sys = { git =
"https://github.com/tinyhumansai/whisper-rs-sys.git", rev =
"229cb4c97e41ca302d3f13b1fa7e93a9b417a5f9" }) so CI runs that don’t use --locked
cannot refresh to a different commit.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fda8f977-f1ae-4ff1-a7b6-456b1b5ed80c

📥 Commits

Reviewing files that changed from the base of the PR and between d930c47 and 74910aa.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • Cargo.toml

@graycyrus graycyrus merged commit d73ccda into tinyhumansai:main Apr 2, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants