Skip to content

Fix PS5.1 compatibility and add path-length warning in build.ps1#2515

Open
dcwhite wants to merge 1 commit into
masterfrom
windows-build-script-fixes
Open

Fix PS5.1 compatibility and add path-length warning in build.ps1#2515
dcwhite wants to merge 1 commit into
masterfrom
windows-build-script-fixes

Conversation

@dcwhite

@dcwhite dcwhite commented Jun 16, 2026

Copy link
Copy Markdown
Member

Summary

  • Replace the PowerShell 7-only ?? null-coalescing operator (line 739) with a PS 5.1-compatible if/else block — fixes a parse error on Windows' default PowerShell version reported in #2512
  • Add a runtime warning when the resolved build directory path exceeds 50 characters, alerting users before they hit Windows' 260-character MAX_PATH limit deep in the Superbuild tree
  • Expand -BuildDir parameter documentation with an IMPORTANT note on the MAX_PATH limit, recommended short paths (C:\SR, D:\build), and update the example accordingly

Test plan

  • Run build.ps1 on Windows PowerShell 5.1 (the default) — should no longer error on ??
  • Run with a long default path (repo checked out deep in C:\Users\...) and confirm the path-length warning fires
  • Run with -BuildDir "C:\SR" and confirm no warning and clean configure/build
  • Get-Help .\build.ps1 -Full shows the updated -BuildDir documentation

Closes the issue reported in #2512

🤖 Generated with Claude Code

Replace the PowerShell 7-only ?? null-coalescing operator with a PS 5.1-compatible
if/else block so the script works on the Windows-default PS version. Add a runtime
warning when the resolved build directory path exceeds 50 characters, and expand
the -BuildDir parameter documentation to explain the Windows MAX_PATH (260-char)
limit that causes cryptic MSVC C1083 errors in deeply nested Superbuild trees.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dcwhite dcwhite requested review from jab0707 and jessdtate June 16, 2026 23:54
@dcwhite dcwhite self-assigned this Jun 16, 2026
@dcwhite dcwhite added the Build label Jun 16, 2026
@dcwhite dcwhite added this to the Refactor Build System milestone Jun 16, 2026
@dcwhite dcwhite enabled auto-merge June 17, 2026 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant