Skip to content

Commit ffc1142

Browse files
committed
fix: build Windows quiche with static CRT (/MT) to match consumers
Set RUSTFLAGS -C target-feature=+crt-static on Windows so quiche + bundled BoringSSL use the static MSVC runtime, matching /MT consumers (avoids LNK2038).
1 parent cb04530 commit ffc1142

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

build-quiche.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,14 @@ def build_target(platform, arch, target, src_dir, release):
186186
run_command(cargo_cmd, cwd=src_dir, env=env)
187187

188188
else: # desktop: mac / linux / win
189+
if platform == "win":
190+
# mystralnative links Windows with the STATIC MSVC runtime (/MT), like
191+
# Skia/V8/Dawn. quiche + its bundled BoringSSL must match, otherwise
192+
# linking fails with LNK2038 (MD_DynamicRelease vs MT_StaticRelease).
193+
# The crt-static target-feature makes Rust use /MT and cmake-rs set
194+
# CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded for the BoringSSL build.
195+
existing = env.get("RUSTFLAGS", "")
196+
env["RUSTFLAGS"] = (existing + " -C target-feature=+crt-static").strip()
189197
cargo_cmd = ["cargo", "build", "--target", target,
190198
"--package", "quiche", "--features", "ffi"]
191199
if release:

0 commit comments

Comments
 (0)