Skip to content

fix(vecadd): link advapi32 for windows nanorand#365

Open
CharryWu wants to merge 2 commits intoRust-GPU:mainfrom
CharryWu:main
Open

fix(vecadd): link advapi32 for windows nanorand#365
CharryWu wants to merge 2 commits intoRust-GPU:mainfrom
CharryWu:main

Conversation

@CharryWu
Copy link

Summary

Fixes the Windows build failure for the vecadd example when using nanorand, and re-enables vecadd in the Windows CI workflow. See the full error output in issue: #364

On x86_64-pc-windows-msvc, nanorand's Windows entropy backend calls SystemFunction036 (a.k.a. RtlGenRandom), which is exported from advapi32.dll. The vecadd example was not explicitly linking advapi32, so building vecadd on Windows failed with:

  • LNK2019: unresolved external symbol SystemFunction036
  • followed by LNK1120: 1 unresolved externals

This change updates examples/vecadd/build.rs to link advapi32 on Windows via a cargo:rustc-link-lib=advapi32 directive in the build script. This supplies the missing import library (advapi32.lib) to the MSVC linker, resolving the symbol and allowing cargo build -p vecadd to succeed on Windows.

In addition, the Windows CI workflow previously excluded vecadd because of this link error. Now that the issue is fixed, the CI configuration is updated to include vecadd again in the workspace build step.

Details

  • Scope is limited to:
    • The vecadd example’s build script.
    • The Windows CI workflow configuration.
  • Changes are gated behind #[cfg(target_os = "windows")] in the build script, so non-Windows platforms are unaffected.
  • The CI comment and --exclude "vecadd*" have been removed; the workspace build now only excludes cudnn and cudnn-sys on Windows.

Attribution

This bug was triaged and fixed with the help of Cursor.

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.

1 participant