Commit 35d67df
committed
build(guix): add x86_64-pc-windows-msvc cross-compilation
Adds a fourth reproducibility target: the MSVC ABI Windows build that
CKB's CI currently produces via a Visual Studio runner. Cross-compiled
from Linux using clang-cl + lld-link and an xwin-extracted Microsoft SDK
(user-provided at depends/SDKs/msvc-vs17-sdk10.0.22621, same pattern as
the Apple SDK for darwin).
What changes:
* manifest.scm — a (string-suffix? "-pc-windows-msvc" target) cond
branch that pulls in clang-toolchain-20, lld-20, rust-src-pkg, and
zip. rust-src-pkg was inlined in the darwin branch; it's now a
top-level definition shared between darwin and windows-msvc because
both need the Rust source to build library/std from scratch via x.py.
* guix-build — x86_64-pc-windows-msvc in SUPPORTED_HOSTS; MSVC SDK
detection block modelled on OSX_SDK; --share the SDK into the guix
container and pass MSVC_SDK into the environment.
* libexec/build.sh — new HOST case with clang-cl as REAL_CC and an
lld-link wrapper (cross-lld-link) that injects /LIBPATH: for the
xwin SDK lib directories so neither x.py nor rustc has to know the
paths. x.py builds library/std from source using the same pattern
as darwin (config.toml, checksum regen, host rustlib copy). The
host rustlib copy now chmod -R u+w so subsequent `rm -rf distsrc`
can clean up the /gnu/store-read-only files (latent bug: also
affected darwin on reruns). RUSTFLAGS carries /Brepro and
/DEBUG:NONE for a deterministic PE.
* libexec/rust-linker.sh — dedicated *-pc-windows-msvc case that
forwards rustc's linker args verbatim to lld-link. The previous
*windows* branch is kept for MinGW and now explicitly excludes msvc
(the two take different flag dialects — GNU-style -Wl,... vs MSVC
/FLAG).
Patch pipeline refactor (prerequisite):
* Replace the sed-based patch_vendored_crate with a helper,
apply_vendored_patch, that applies a real .patch file to a vendored
crate directory and refreshes .cargo-checksum.json afterwards so
cargo --frozen accepts the modified files. The existing
rocksdb-cross-compile-platform.patch was stale (wrong hunk line
counts, also semantically incorrect for darwin) — replaced with
ckb-librocksdb-sys-cross-compile.patch, regenerated from a real
git diff.
* New patches/ckb-vm-msvc-cc-env.patch: ckb-vm 0.24.14's build.rs
hardcodes build.compiler("gcc") for its is_msvc branch (to route
its GNU AT&T-syntax execute_x64.S through a GNU assembler, which
works on a native Windows machine that also has MinGW-w64's gcc
installed alongside cl.exe). For cross-compile from Linux, "gcc"
resolves to the host's Linux cc which cannot emit MSVC COFF. The
patch adds a CKB_VM_ASM_CC env-var override — build.sh sets it to
clang-cl, which handles GNU AT&T .S via LLVM's integrated assembler
and produces valid MSVC-ABI COFF.
Reproducibility verified:
x86_64-pc-windows-msvc: e31f5af8e04efde939f09d66cc3b1a77534f1cf575f5f9afc36894bdbbdd6226
- host run 1, host run 2, docker run: all identical
The existing four targets are unaffected by the patch-pipeline refactor
(mingw re-verified post-refactor at 39901c3e..., matching the pre-refactor
hash byte-for-byte; linux/aarch64-linux never hit that code path).
The xwin SDK is user-provided. The release flow documents pinning
\`xwin --manifest-version 17 --sdk-version 10.0.22621\` — two xwin
extractions from the same pin produce byte-identical trees (5547 files
+ 2895 symlinks, all matching), so users can either re-run xwin or
consume a pre-extracted tarball. Microsoft's Visual Studio Build Tools
EULA applies to the SDK; xwin's --accept-license flag handles it.1 parent e055c61 commit 35d67df
7 files changed
Lines changed: 422 additions & 93 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
123 | 135 | | |
124 | 136 | | |
125 | 137 | | |
| |||
207 | 219 | | |
208 | 220 | | |
209 | 221 | | |
| 222 | + | |
210 | 223 | | |
211 | 224 | | |
212 | 225 | | |
| 226 | + | |
213 | 227 | | |
214 | 228 | | |
215 | 229 | | |
| |||
0 commit comments