[PR #2060] fix: detect Visual Studio Preview installations #2068

Open
opened 2026-11-26 21:19:55 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2060
Author: @hcentral07
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: fix/vs-insiders-detection


📝 Commits (1)

  • dad93dc fix: detect Visual Studio Preview installations

📊 Changes

1 file changed (+34 additions, -11 deletions)

View changed files

📝 scripts/build_llvm_mc.ps1 (+34 -11)

📄 Description

Claimed in the coordination issue as: TEST-XX

Depends on:
Fixes:

What and why

scripts/build_llvm_mc.ps1 failed on machines where Visual Studio is
installed only as Preview/Insiders, and reported the wrong error when
Visual Studio (or its C++ x64 workload) is missing entirely:

  • vswhere.exe was invoked at a hard-coded path with no existence check,
    so a machine with no VS threw a raw CommandNotFoundException before the
    script's "Visual Studio wasn't found" message could fire.
  • vswhere hides Preview/Insiders instances unless -prerelease is passed,
    so those users were told VS wasn't installed even though it was.
  • A VS install with the C++ x64 component listed but the workload broken
    died deep inside cmd.exe instead of failing with a clear message.

This makes VS detection fall back to -prerelease, guards the
vswhere.exe path, normalizes vswhere output (drops empty lines, takes
the first path), and verifies vcvars64.bat exists before the build starts.

Tested

  • powershell -ExecutionPolicy Bypass -File scripts\build_llvm_mc.ps1
    on a machine with VS 2022 stable: builds llvm-mc.exe, the s_endpgm
    probe passes, LLVM_MC is set.
  • VS 2022 Preview/Insiders only: detection now succeeds via -prerelease
    (previously reported "not found").
  • No VS at all: fails with Visual Studio wasn't found (vswhere.exe missing at '…') instead of a raw cmdlet error.
  • vcvars64.bat moved away: fails with vcvars64.bat wasn't found at '…'; the VS install looks incomplete.

GPUs tested: n/a (build-script change; the post-build s_endpgm probe ran
on a gfx1013 console but is the existing check, unchanged)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a — no translator rule changed; the box is checked only because the checklist reads as all-or-nothing. If your repo treats n/a as unchecked, leave it [ ] and note "n/a" here.)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2060 **Author:** [@hcentral07](https://github.com/hcentral07) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/vs-insiders-detection` --- ### 📝 Commits (1) - [`dad93dc`](https://github.com/ubiquitarianism/leonida/commit/dad93dcb7fd96002b08ce5c62b73863c33404a1f) fix: detect Visual Studio Preview installations ### 📊 Changes **1 file changed** (+34 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `scripts/build_llvm_mc.ps1` (+34 -11) </details> ### 📄 Description Claimed in the coordination issue as: TEST-XX Depends on: <!-- none --> Fixes: <!-- #N if this closes a "VS Preview not detected" / toolchain-detection issue; otherwise delete --> ### What and why `scripts/build_llvm_mc.ps1` failed on machines where Visual Studio is installed only as Preview/Insiders, and reported the wrong error when Visual Studio (or its C++ x64 workload) is missing entirely: - `vswhere.exe` was invoked at a hard-coded path with no existence check, so a machine with no VS threw a raw `CommandNotFoundException` before the script's "Visual Studio wasn't found" message could fire. - `vswhere` hides Preview/Insiders instances unless `-prerelease` is passed, so those users were told VS wasn't installed even though it was. - A VS install with the C++ x64 component listed but the workload broken died deep inside `cmd.exe` instead of failing with a clear message. This makes VS detection fall back to `-prerelease`, guards the `vswhere.exe` path, normalizes `vswhere` output (drops empty lines, takes the first path), and verifies `vcvars64.bat` exists before the build starts. ### Tested - `powershell -ExecutionPolicy Bypass -File scripts\build_llvm_mc.ps1` on a machine with VS 2022 stable: builds `llvm-mc.exe`, the `s_endpgm` probe passes, `LLVM_MC` is set. - VS 2022 Preview/Insiders only: detection now succeeds via `-prerelease` (previously reported "not found"). - No VS at all: fails with `Visual Studio wasn't found (vswhere.exe missing at '…')` instead of a raw cmdlet error. - `vcvars64.bat` moved away: fails with `vcvars64.bat wasn't found at '…'; the VS install looks incomplete.` GPUs tested: n/a (build-script change; the post-build `s_endpgm` probe ran on a gfx1013 console but is the existing check, unchanged) AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. *(n/a — no translator rule changed; the box is checked only because the checklist reads as all-or-nothing. If your repo treats n/a as unchecked, leave it `[ ]` and note "n/a" here.)* --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#2068
No description provided.