Skip to content

docs: add native Windows MSVC build guide (no Docker / no WSL2)#455

Closed
grimmjoww wants to merge 1 commit intotensorchord:mainfrom
grimmjoww:windows-msvc-build-support
Closed

docs: add native Windows MSVC build guide (no Docker / no WSL2)#455
grimmjoww wants to merge 1 commit intotensorchord:mainfrom
grimmjoww:windows-msvc-build-support

Conversation

@grimmjoww
Copy link
Copy Markdown

TL;DR

Decided to fuck around and find out — vchord builds natively on Windows MSVC. No Docker, no WSL2. This PR is documentation only; the codebase already supports x86_64-pc-windows-msvc as a target in xtask, just nobody had written the toolchain doc yet.

Result

Built a working vchord.dll on Windows 11 with:

  • Visual Studio 2022 Community (MSVC)
  • LLVM 22.1.4 (clang + libclang for pgrx-pg-sys bindgen)
  • Rust 1.95.0 stable
  • cargo-pgrx 0.17.0 (matching the pgrx pin)
  • PostgreSQL 17.9 (EnterpriseDB installer)

Output: vchord.dll 9.4 MB PE32+ x64. dumpbin /dependents shows imports against postgres.exe, KERNEL32, ntdll, VCRUNTIME140, UCRT — exactly the same shape as pgvector's Windows DLL.

What changed

  • docs/WINDOWS.md — new file with full toolchain + build + install + verification steps, and a "Pitfalls" section documenting the things that bit me
  • README.md — one line under Quick Start pointing Windows users at the new doc

No source-code changes needed at all. The build "just worked" once the toolchain was set up.

The one gotcha worth highlighting

Rust 1.93 and 1.94 fail to build with E0658: use of unstable library feature 'stdarch_x86_avx512_f16' in crates/simd/src/floating_f16.rs:2014+. Those AVX-512 FP16 intrinsics (_mm512_fmadd_ph, _mm512_castsi512_ph, etc.) were stabilized in Rust 1.95.0 (April 2026). After rustup update, the build is clean — zero warnings, zero errors.

Worth noting in case anyone else hits this on slightly-older nightly/stable channels. The Linux CI didn't catch it because their rustup update step pulls latest stable.

Suggested follow-up (separate PR if you want it)

Add a Windows runner to .github/workflows/release.yml so users get a prebuilt vchord-pg17-x86_64-windows-msvc.zip artifact alongside the existing Linux .deb / .zip. Happy to draft that if there's interest.

Test plan

  • cargo run -p xtask --release -- build produces build\pkglibdir\vchord.dll + extension SQL + control file
  • dumpbin /dependents vchord.dll shows clean Windows dependency graph
  • Zero warnings, zero errors at release profile
  • CI green on this PR (docs only — should be trivial)

Vibe-coded. 0% code from me, all from Claude. Co-author credit on the commit because I wanted it. We're shipping unlimited embeddings/vectors energy. 🚀

Closes the gap on Windows-native builds without changing your build system at all — just documenting what already works.

Documents the toolchain and steps for producing a working `vchord.dll` on
Windows without Docker or WSL2. The codebase already lists
`x86_64-pc-windows-msvc` as a default cargo target in `xtask`; this just
fills in the gap so anyone with PostgreSQL on Windows can reproduce the
build.

Verified end-to-end on Windows 11 + VS2022 + LLVM 22.1.4 + Rust 1.95.0 +
cargo-pgrx 0.17.0 + PostgreSQL 17.9. Output is a 9.4 MB PE32+ DLL that
imports symbols from `postgres.exe` exactly the way pgvector's Windows
extension does (verified via `dumpbin /dependents`).

Key gotchas captured:
- Rust 1.95+ required (1.93/1.94 fail on `stdarch_x86_avx512_f16` in
  `crates/simd/src/floating_f16.rs`; that feature was stabilized in 1.95)
- `cargo pgrx init` does not auto-download Postgres on Windows
- `xtask build` requires `PG_CONFIG` env var
- vcvars64.bat env doesn't propagate to bash sessions

No source-code changes required — purely documentation. The only
behaviorally-relevant follow-up would be adding a Windows runner to
`.github/workflows/release.yml` so users get a prebuilt
`vchord-pg17-x86_64-windows-msvc.zip` artifact alongside the existing
Linux .deb / .zip outputs. Happy to follow up with that PR if maintainers
want it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@grimmjoww
Copy link
Copy Markdown
Author

Closing this PR.

After reading the CLA, the clauses granting TensorChord an irrevocable, transferable, sublicensable license — explicitly including the right to relicense contributions under "commercial, or proprietary license" and to "change or modify the license... from time to time" — go further than I'm comfortable with as a default for my contributions. I keep my work open and don't want to set a precedent of granting anyone the perpetual right to relicense it as proprietary later. That's a personal stance about how I license my own work, not a knock on vchord — the build itself was great and just worked once the toolchain was in place.

The Windows build documentation and helper scripts remain available at https://github.com/grimmjoww/vchord-windows-port under MIT for the community.

If anyone at TensorChord wants to incorporate the content into the official repo, please feel free to rewrite under your CLA — it documents an existing build path you already support, not novel IP. Happy to answer questions or clarify any of the build steps.

Thanks for vchord. The Windows-native build genuinely works; just sharing the toolchain notes openly without the CLA gate.

@grimmjoww grimmjoww closed this Apr 25, 2026
@grimmjoww grimmjoww deleted the windows-msvc-build-support branch April 25, 2026 08:02
@usamoi
Copy link
Copy Markdown
Contributor

usamoi commented Apr 25, 2026

It's already documented in Installation that x86_64 Windows is supported and tested. Source lists the environment requirements of building from source and installation steps.

The Linux CI didn't catch it because their rustup update step pulls latest stable.

It's expected. We will raise the required Rust version with each new release. The main branch always requires latest stable Rust.

Add a Windows runner to .github/workflows/release.yml so users get a prebuilt vchord-pg17-x86_64-windows-msvc.zip artifact

We don't build precompiled binaries unless strictly necessary. Mismatches between the ABIs of a precompiled VectorChord and the user's PostgreSQL can lead to critical failures. We only provide precompiled PostgreSQL packages for Debian/Linux that depend on the pgdg repository, rather than generic linux-gnu binaries, specifically because we have no way of knowing how users on other systems obtain their PostgreSQL installation.

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