Build: set up the MSVC linker and SDK libraries from Git Bash #943
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/944"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from fxceless/victory-fork. Originally posted by HailLucifer666 on 2026-11-25T13:24:55Z.
Problem
Git Bash ships
/usr/bin/link.exe— GNU coreutils'link, the syscall wrapper — which comes first onPATHand shadows the MSVC linker of the same name.rustcthen reports:which blames the workload even when the workload is installed and only
LIBis unset. That message sent this session hunting for a missing Visual Studio component that was never missing; the real cause was a wrongPATHand an emptyLIB.Fix
scripts/msvc-env.sh, sourced (. scripts/msvc-env.sh):vswhere, falling back to any layout under a drive root, then converts the Windows-form pathvswhereanswers with into POSIX form — aPATHentry inF:\VS C++form does not resolve from Git Bash, which is how GNUlinkkept winning even afterPATHwas "fixed".LIBas the semicolon-separated Windows paths the linker wants (the toolchain's ownlib/x64, then the SDK'sum/x64anducrt/x64).VICTORY_MSVCandVICTORY_WINDOWS_KITS.Nothing is hardcoded to one machine. With no usable toolchain it says why and changes nothing, so sourcing it is always safe.
Verified here
rustc hello.rslinks and the binary runs;which link.exeresolves to the MSVC one; withVICTORY_MSVC=/nopeit prints the reason and leavesLIBunset.Imported from fxceless/victory-fork. Originally posted by avt0m4t48 on 2026-11-25T16:09:48Z.
I checked the helper at
6aa4add3with synthetic toolchain and SDK directories in Bash and dash on Linux, using a test double forcygpath. The helper file is identical in GitHub’s test merge and when applied to main at39731795. The complete SDK, Windows-form MSVC path with spaces, and missing-linker controls passed in both shells.I reproduced two SDK selection cases with a valid linker override:
Lib/10.0.10.0/{um,ucrt}/x64and onlyLib/10.0.11.0/um/x64, the helper chooses10.0.11.0and setsLIBto include its missingucrt/x64. The older complete version is available.VICTORY_WINDOWS_KITSset to a nonexistent root or a root with an emptyLib, the helper printsSDK libraries:with an empty value and overwrites an existingLIB. In this case_veris empty, so the SDK arguments passed tocygpath -ware/um/x64and/ucrt/x64.Could the helper pick the newest version containing both x64 directories and warn while preserving
LIBif none can be used? These checks exercised shell selection and environment output. Native Git Bash and MSVC linking remain unverified in this run.Imported from fxceless/victory-fork. Originally posted by HailLucifer666 on 2026-11-25T20:20:19Z.
Fixed both SDK-selection edge cases in
3aca156f(thanks@avt0m4t48):_vernow selects the newestLib/10.*directory that contains bothum/x64anducrt/x64, skipping incomplete SDKs.VICTORY_WINDOWS_KITS),scripts/msvc-env.shwarns and preserves the existingLIBinstead of overwriting it.Verified in Git Bash (
sh) against synthetic fixtures for both cases plus the local MSVC + Windows 10.0.26100.0 SDK toolchain.Imported from fxceless/victory-fork. Originally posted by HailLucifer666 on 2026-11-26T14:11:20Z.
The two SDK-selection cases from your review are addressed at head
3aca156f:_vernow requires bothum/x64anducrt/x64before choosing a version, and an unusableVICTORY_WINDOWS_KITSkeeps the existingLIBand warns instead of replacing it. Could you retest those two scenarios against this head when you have a moment? The helper itself is unchanged since your run; only the selection logic moved.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.