From 9dfa7c20a6403dd358e475008e397f4819c51d90 Mon Sep 17 00:00:00 2001 From: Charry Wu Date: Sat, 14 Mar 2026 07:54:29 -0700 Subject: [PATCH 1/2] fix(vecadd): link advapi32 for windows nanorand Made-with: Cursor --- examples/vecadd/build.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/examples/vecadd/build.rs b/examples/vecadd/build.rs index 7f23bac1..ea054c7d 100644 --- a/examples/vecadd/build.rs +++ b/examples/vecadd/build.rs @@ -4,6 +4,12 @@ use std::path; use cuda_builder::CudaBuilder; fn main() { + // On Windows, nanorand's entropy uses SystemFunction036 (RtlGenRandom) from advapi32. + // Explicitly link it so the MSVC linker resolves the symbol (avoids LNK2019 when + // mixing CRTs or with certain link orders). + #[cfg(target_os = "windows")] + println!("cargo:rustc-link-lib=advapi32"); + println!("cargo::rerun-if-changed=build.rs"); println!("cargo::rerun-if-changed=kernels"); From 9d507dc9ad5b26ccdbe115ecbfb1372718fc490a Mon Sep 17 00:00:00 2001 From: Charry Wu Date: Sat, 14 Mar 2026 07:59:15 -0700 Subject: [PATCH 2/2] ci(windows): include vecadd in workspace build Made-with: Cursor --- .github/workflows/ci_windows.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci_windows.yml b/.github/workflows/ci_windows.yml index f072cb20..ca2251b2 100644 --- a/.github/workflows/ci_windows.yml +++ b/.github/workflows/ci_windows.yml @@ -106,10 +106,8 @@ jobs: run: cargo build --all-features -p cust_raw # Exclude crates that require cuDNN, not available on Windows CI: cudnn, cudnn-sys. - # Exclude vecadd because of a link error involving nanorand and `SystemFunction036` (a.k.a. - # `RtlGenRandom`). - name: Build workspace - run: cargo build --workspace --exclude cudnn --exclude cudnn-sys --exclude "vecadd*" + run: cargo build --workspace --exclude cudnn --exclude cudnn-sys # Exclude crates that require cuDNN, not available on Windows CI: cudnn, cudnn-sys. - name: Clippy