Set LIBCLANG_PATH and verify the Windows SDK in rb msvc - #9
Merged
Conversation
bindgen probes the Visual Studio install for libclang.dll without consulting PATH and picks between the ARM64 and x64 copies non-deterministically, so an rb-sys gem build fails intermittently on an x64 host. Separately, vswhere's -requires confirms the MSVC component is installed but not that its Windows SDK libraries are on disk, which otherwise surfaces much later as a linker error with no obvious cause. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The stub VsDevCmd.bat now sits at the layout position a real one occupies, so the installationPath derived from it resolves the sibling VC\Tools\Llvm tree and the x64-over-ARM64 selection is pinned rather than assumed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
An rb-sys Rust extension gem fails to build under
rb msvcat random. bindgen probes the Visual Studio install forlibclang.dllwithout consultingPATH, and a VS install carries both an ARM64 and an x64 copy, so which one it reaches is not deterministic. The ARM64 one fails on an x64 host. Three consecutivecargo buildruns in a fresh directory failed withLIBCLANG_PATHunset and succeeded with it set, so activation now sets it. A value the user already has is left alone.The second change closes a separate gap.
vswhere -requiresconfirms the MSVC component is installed but not that its Windows SDK libraries are on disk. A machine in that state reportedlinker `link.exe` not found, which a coreutilslink.exeonPATHthen turned into an unrelated-looking argument error. Activation now checkskernel32.libunder the reportedWindowsSdkDirand refuses with an actionable message.