fix(vecadd): link advapi32 for windows nanorand#365
Open
CharryWu wants to merge 2 commits intoRust-GPU:mainfrom
Open
fix(vecadd): link advapi32 for windows nanorand#365CharryWu wants to merge 2 commits intoRust-GPU:mainfrom
CharryWu wants to merge 2 commits intoRust-GPU:mainfrom
Conversation
Made-with: Cursor
Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the Windows build failure for the
vecaddexample when usingnanorand, and re-enablesvecaddin the Windows CI workflow. See the full error output in issue: #364On
x86_64-pc-windows-msvc,nanorand's Windows entropy backend callsSystemFunction036(a.k.a.RtlGenRandom), which is exported fromadvapi32.dll. Thevecaddexample was not explicitly linkingadvapi32, so buildingvecaddon Windows failed with:LNK2019: unresolved external symbol SystemFunction036LNK1120: 1 unresolved externalsThis change updates
examples/vecadd/build.rsto linkadvapi32on Windows via acargo:rustc-link-lib=advapi32directive in the build script. This supplies the missing import library (advapi32.lib) to the MSVC linker, resolving the symbol and allowingcargo build -p vecaddto succeed on Windows.In addition, the Windows CI workflow previously excluded
vecaddbecause of this link error. Now that the issue is fixed, the CI configuration is updated to includevecaddagain in the workspace build step.Details
vecaddexample’s build script.#[cfg(target_os = "windows")]in the build script, so non-Windows platforms are unaffected.--exclude "vecadd*"have been removed; the workspace build now only excludescudnnandcudnn-syson Windows.Attribution
This bug was triaged and fixed with the help of Cursor.