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 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");