From 3122a84a7d2621a367b5a9e6d23c642dd537c7ff Mon Sep 17 00:00:00 2001 From: Wesley Maxey Date: Fri, 26 Jun 2026 13:02:22 -0700 Subject: [PATCH 1/3] Add ATL and LLVM tools --- windows/build-windows-image.ps1 | 54 ++++++++------ windows/image/installers/install-vs.ps1 | 98 ++++++++++++------------- 2 files changed, 79 insertions(+), 73 deletions(-) diff --git a/windows/build-windows-image.ps1 b/windows/build-windows-image.ps1 index 425998238..7e149e4ef 100644 --- a/windows/build-windows-image.ps1 +++ b/windows/build-windows-image.ps1 @@ -1,25 +1,25 @@ # clVersion, cudaVersion, OS edition, isolation mode Param( - [Parameter(Mandatory=$true)] + [Parameter(Mandatory = $true)] [string] - $clVersion="latest", - [Parameter(Mandatory=$false)] + $clVersion = "latest", + [Parameter(Mandatory = $false)] [string] - $cudaVersion="latest", - [Parameter(Mandatory=$false)] - [ValidateSet('windows2019', 'windows2022')] + $cudaVersion = "latest", + [Parameter(Mandatory = $false)] + [ValidateSet('windows2019', 'windows2022', 'windows2025')] [string] - $edition="windows", - [Parameter(Mandatory=$false)] + $edition = "windows", + [Parameter(Mandatory = $false)] [ValidateSet('hyperv', 'process')] [string] - $isolation="hyperv", - [Parameter(Mandatory=$false)] + $isolation = "hyperv", + [Parameter(Mandatory = $false)] [string] - $repo="local", - [Parameter(Mandatory=$false)] + $repo = "local", + [Parameter(Mandatory = $false)] [string] - $repoVersion="latest" + $repoVersion = "latest" ) function TestReturnCode { @@ -31,6 +31,7 @@ function TestReturnCode { Push-location "$PSScriptRoot" $rootWindowsImage = @{ + "windows2025" = "mcr.microsoft.com/windows/servercore:ltsc2025" "windows2022" = "mcr.microsoft.com/windows/servercore:ltsc2022" "windows2019" = "mcr.microsoft.com/windows/servercore:ltsc2019" }[$edition] @@ -41,13 +42,13 @@ try { $vsVer = $vsYearToVer[$vsCompilersToYear[$clVersion]] # Override defaults in .env. - $ENV:IMAGE_NAME="$(.\generate-image-name.ps1 -clVersion $clVersion -cudaVersion $cudaVersion -edition $edition -repo $repo -repoVersion $repoVersion)" - $ENV:ISOLATION="$isolation" - $ENV:MSVC_VER="$vsVer" - $ENV:MSVC_COMPILER_VER="$clVersion" - $ENV:CUDA_VER="$cudaVersion" - $ENV:ROOT_IMAGE="$rootWindowsImage" - $ENV:BUILDKIT_PROGRESS="plain" + $ENV:IMAGE_NAME = "$(.\generate-image-name.ps1 -clVersion $clVersion -cudaVersion $cudaVersion -edition $edition -repo $repo -repoVersion $repoVersion)" + $ENV:ISOLATION = "$isolation" + $ENV:MSVC_VER = "$vsVer" + $ENV:MSVC_COMPILER_VER = "$clVersion" + $ENV:CUDA_VER = "$cudaVersion" + $ENV:ROOT_IMAGE = "$rootWindowsImage" + $ENV:BUILDKIT_PROGRESS = "plain" Write-Output "Building $ENV:IMAGE_NAME" Write-Output "with args:" @@ -58,7 +59,18 @@ try { Write-Output "ENV:CUDA_VER $ENV:CUDA_VER" Write-Output "ENV:ROOT_IMAGE $ENV:ROOT_IMAGE" - docker build --file .\windows.Dockerfile --tag "$ENV:IMAGE_NAME" --isolation "$ENV:ISOLATION" --build-arg MSVC_VER="$ENV:MSVC_VER" --build-arg MSVC_COMPILER_VER="$ENV:MSVC_COMPILER_VER" --build-arg CUDA_VER="$ENV:CUDA_VER" --build-arg ROOT_IMAGE="$ENV:ROOT_IMAGE" .\image + ctr i pull "$ENV:ROOT_IMAGE" + buildctl build ` + --frontend=dockerfile.v0 ` + --local dockerfile=.\ ` + --opt filename=windows.Dockerfile ` + --local context=.\image ` + --output "type=image,name=$ENV:IMAGE_NAME,compression=zstd,force-compression=true,platform=windows/amd64" ` + --opt build-arg:MSVC_VER="$ENV:MSVC_VER" ` + --opt build-arg:MSVC_COMPILER_VER="$ENV:MSVC_COMPILER_VER" ` + --opt build-arg:CUDA_VER="$ENV:CUDA_VER" ` + --opt build-arg:ROOT_IMAGE="$ENV:ROOT_IMAGE" ` + .\image } catch { Pop-Location diff --git a/windows/image/installers/install-vs.ps1 b/windows/image/installers/install-vs.ps1 index 8e3e926f8..af82de141 100644 --- a/windows/image/installers/install-vs.ps1 +++ b/windows/image/installers/install-vs.ps1 @@ -1,67 +1,61 @@ Param( - [Parameter(Mandatory=$true)] + [Parameter(Mandatory = $true)] [ValidateSet('15', '16', '17', '18')] [string] $msvcVersion, - [Parameter(Mandatory=$false)] + [Parameter(Mandatory = $false)] [string] - $clVersion + $clVersion = "latest" ) $msvcPath = "C:\msbuild\$msvcVersion" -$vsComponentsMap = @{ - "15" = "Microsoft.VisualStudio.Component.Windows10SDK.17763" - "16" = "Microsoft.VisualStudio.Component.Windows10SDK.19041" - "17" = "Microsoft.VisualStudio.Component.Windows11SDK.22621" - "18" = "Microsoft.VisualStudio.Component.Windows11SDK.22621" - "14.14" = "Microsoft.VisualStudio.Component.VC.Tools.14.14" - "14.15" = "Microsoft.VisualStudio.Component.VC.Tools.14.15" - "14.16" = "Microsoft.VisualStudio.Component.VC.Tools.14.16" - "14.27" = "Microsoft.VisualStudio.Component.VC.14.27.x86.x64" - "14.28" = "Microsoft.VisualStudio.Component.VC.14.28.x86.x64" - "14.29" = "Microsoft.VisualStudio.Component.VC.14.29.x86.x64" - "14.34" = "Microsoft.VisualStudio.Component.VC.14.34.17.4.x86.x64" - "14.35" = "Microsoft.VisualStudio.Component.VC.14.35.17.5.x86.x64" - "14.36" = "Microsoft.VisualStudio.Component.VC.14.36.17.6.x86.x64" - "14.37" = "Microsoft.VisualStudio.Component.VC.14.37.17.7.x86.x64" - "14.38" = "Microsoft.VisualStudio.Component.VC.14.38.17.8.x86.x64" - "14.39" = "Microsoft.VisualStudio.Component.VC.14.39.17.9.x86.x64" - "14.40" = "Microsoft.VisualStudio.Component.VC.14.40.17.10.x86.x64" - "14.41" = "Microsoft.VisualStudio.Component.VC.14.41.17.11.x86.x64" - "14.42" = "Microsoft.VisualStudio.Component.VC.14.42.17.12.x86.x64" - "14.43" = "Microsoft.VisualStudio.Component.VC.14.43.17.13.x86.x64" - "14.44" = "Microsoft.VisualStudio.Component.VC.14.44.17.14.x86.x64" - "14.50" = "Microsoft.VisualStudio.Component.VC.14.50.18.0.x86.x64" - "latest" = "Microsoft.VisualStudio.Component.VC.Tools.x86.x64" -} - -$channelMap = @{ - "15"="release" - "16"="release" - "17"="release" - "18"="insiders" -} -$channel = $channelMap[$msvcVersion] - -# Always install/update core VC tools -$vsComponent = $vsComponentsMap[$msvcVersion] -$vsComponentString = "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add $vsComponent" - -if ($clVersion) { - $clComponent = $vsComponentsMap[$clVersion] - $vsComponentString = "$vsComponentString --add $clComponent" -} - -# 14.16 alone does not install build tools -if ($clVersion -eq "14.16") { - $clComponent = $vsComponentsMap["14.15"] - $vsComponentString = "$vsComponentString --add $clComponent" -} +$vsComponentVersion = @{ + "14.27" = "14.27" + "14.28" = "14.28" + "14.29" = "14.29" + "14.34" = "14.34.17.4" + "14.35" = "14.35.17.5" + "14.36" = "14.36.17.6" + "14.37" = "14.37.17.7" + "14.38" = "14.38.17.8" + "14.39" = "14.39.17.9" + "14.40" = "14.40.17.10" + "14.41" = "14.41.17.11" + "14.42" = "14.42.17.12" + "14.43" = "14.43.17.13" + "14.44" = "14.44.17.14" + "14.50" = "14.50.18.0" + "latest" = "14.50.18.0" +}[$clVersion] + +$sdkComponent = @{ + "15" = "Microsoft.VisualStudio.Component.Windows10SDK.17763" + "16" = "Microsoft.VisualStudio.Component.Windows10SDK.19041" + "17" = "Microsoft.VisualStudio.Component.Windows11SDK.22621" + "18" = "Microsoft.VisualStudio.Component.Windows11SDK.22621" +}[$msvcVersion] + +$channel = @{ + "15" = "release" + "16" = "release" + "17" = "release" + "18" = "release" +}[$msvcVersion] + +$requiredVsComponents = ( + "Microsoft.VisualStudio.Component.VC.${vsComponentVersion}.x86.x64", + "Microsoft.VisualStudio.Component.VC.${vsComponentVersion}.ATL", + "Microsoft.VisualStudio.Component.VC.${vsComponentVersion}.ATLMFC", + "Microsoft.VisualStudio.Component.VC.Llvm.Clang", + "Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset", + "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", + $sdkComponent +) -replace '^(?.*)$', ' --add ${comp}' -join "" Invoke-WebRequest -Uri "https://aka.ms/vs/$msvcVersion/$channel/vs_buildtools.exe" -UseBasicParsing -OutFile .\vs_buildtools.exe Write-Output "Installing components: $vsComponentString" -Start-Process -NoNewWindow -PassThru -Wait -FilePath .\vs_buildtools.exe -ArgumentList "install --installWhileDownloading --installPath $msvcPath --wait --norestart --nocache --quiet $vsComponentString" +Start-Process -NoNewWindow -PassThru -Wait -FilePath .\vs_buildtools.exe -ArgumentList "install --installWhileDownloading --installPath $msvcPath --wait --norestart --nocache --quiet $requiredVsComponents" # Add VS to the global environment . "$PSScriptRoot/build-env.ps1" -vcver "$clVersion" From 90a0708fe67ef15f6c10b92416c65f2f988993d8 Mon Sep 17 00:00:00 2001 From: Wesley Maxey Date: Fri, 26 Jun 2026 13:05:36 -0700 Subject: [PATCH 2/3] revert changes to use ctr --- windows/build-windows-image.ps1 | 54 +++++++++++++-------------------- 1 file changed, 21 insertions(+), 33 deletions(-) diff --git a/windows/build-windows-image.ps1 b/windows/build-windows-image.ps1 index 7e149e4ef..425998238 100644 --- a/windows/build-windows-image.ps1 +++ b/windows/build-windows-image.ps1 @@ -1,25 +1,25 @@ # clVersion, cudaVersion, OS edition, isolation mode Param( - [Parameter(Mandatory = $true)] + [Parameter(Mandatory=$true)] [string] - $clVersion = "latest", - [Parameter(Mandatory = $false)] + $clVersion="latest", + [Parameter(Mandatory=$false)] [string] - $cudaVersion = "latest", - [Parameter(Mandatory = $false)] - [ValidateSet('windows2019', 'windows2022', 'windows2025')] + $cudaVersion="latest", + [Parameter(Mandatory=$false)] + [ValidateSet('windows2019', 'windows2022')] [string] - $edition = "windows", - [Parameter(Mandatory = $false)] + $edition="windows", + [Parameter(Mandatory=$false)] [ValidateSet('hyperv', 'process')] [string] - $isolation = "hyperv", - [Parameter(Mandatory = $false)] + $isolation="hyperv", + [Parameter(Mandatory=$false)] [string] - $repo = "local", - [Parameter(Mandatory = $false)] + $repo="local", + [Parameter(Mandatory=$false)] [string] - $repoVersion = "latest" + $repoVersion="latest" ) function TestReturnCode { @@ -31,7 +31,6 @@ function TestReturnCode { Push-location "$PSScriptRoot" $rootWindowsImage = @{ - "windows2025" = "mcr.microsoft.com/windows/servercore:ltsc2025" "windows2022" = "mcr.microsoft.com/windows/servercore:ltsc2022" "windows2019" = "mcr.microsoft.com/windows/servercore:ltsc2019" }[$edition] @@ -42,13 +41,13 @@ try { $vsVer = $vsYearToVer[$vsCompilersToYear[$clVersion]] # Override defaults in .env. - $ENV:IMAGE_NAME = "$(.\generate-image-name.ps1 -clVersion $clVersion -cudaVersion $cudaVersion -edition $edition -repo $repo -repoVersion $repoVersion)" - $ENV:ISOLATION = "$isolation" - $ENV:MSVC_VER = "$vsVer" - $ENV:MSVC_COMPILER_VER = "$clVersion" - $ENV:CUDA_VER = "$cudaVersion" - $ENV:ROOT_IMAGE = "$rootWindowsImage" - $ENV:BUILDKIT_PROGRESS = "plain" + $ENV:IMAGE_NAME="$(.\generate-image-name.ps1 -clVersion $clVersion -cudaVersion $cudaVersion -edition $edition -repo $repo -repoVersion $repoVersion)" + $ENV:ISOLATION="$isolation" + $ENV:MSVC_VER="$vsVer" + $ENV:MSVC_COMPILER_VER="$clVersion" + $ENV:CUDA_VER="$cudaVersion" + $ENV:ROOT_IMAGE="$rootWindowsImage" + $ENV:BUILDKIT_PROGRESS="plain" Write-Output "Building $ENV:IMAGE_NAME" Write-Output "with args:" @@ -59,18 +58,7 @@ try { Write-Output "ENV:CUDA_VER $ENV:CUDA_VER" Write-Output "ENV:ROOT_IMAGE $ENV:ROOT_IMAGE" - ctr i pull "$ENV:ROOT_IMAGE" - buildctl build ` - --frontend=dockerfile.v0 ` - --local dockerfile=.\ ` - --opt filename=windows.Dockerfile ` - --local context=.\image ` - --output "type=image,name=$ENV:IMAGE_NAME,compression=zstd,force-compression=true,platform=windows/amd64" ` - --opt build-arg:MSVC_VER="$ENV:MSVC_VER" ` - --opt build-arg:MSVC_COMPILER_VER="$ENV:MSVC_COMPILER_VER" ` - --opt build-arg:CUDA_VER="$ENV:CUDA_VER" ` - --opt build-arg:ROOT_IMAGE="$ENV:ROOT_IMAGE" ` - .\image + docker build --file .\windows.Dockerfile --tag "$ENV:IMAGE_NAME" --isolation "$ENV:ISOLATION" --build-arg MSVC_VER="$ENV:MSVC_VER" --build-arg MSVC_COMPILER_VER="$ENV:MSVC_COMPILER_VER" --build-arg CUDA_VER="$ENV:CUDA_VER" --build-arg ROOT_IMAGE="$ENV:ROOT_IMAGE" .\image } catch { Pop-Location From 468be57c831b96e054fa36f0315f9f71ee01c99d Mon Sep 17 00:00:00 2001 From: Wesley Maxey Date: Fri, 26 Jun 2026 13:28:16 -0700 Subject: [PATCH 3/3] Fix what release channel is used for VS18 --- windows/image/installers/install-vs.ps1 | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/windows/image/installers/install-vs.ps1 b/windows/image/installers/install-vs.ps1 index af82de141..4a3c87dda 100644 --- a/windows/image/installers/install-vs.ps1 +++ b/windows/image/installers/install-vs.ps1 @@ -36,11 +36,14 @@ $sdkComponent = @{ "18" = "Microsoft.VisualStudio.Component.Windows11SDK.22621" }[$msvcVersion] +# 15,16,17 are release +# 18 is insiders or stable +# ??? why $channel = @{ "15" = "release" "16" = "release" "17" = "release" - "18" = "release" + "18" = "stable" }[$msvcVersion] $requiredVsComponents = ( @@ -51,11 +54,15 @@ $requiredVsComponents = ( "Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", $sdkComponent -) -replace '^(?.*)$', ' --add ${comp}' -join "" +) + +$components = $requiredVsComponents -replace '^(?.*)$', ' --add ${comp}' -join "" +$vsBtUrl = "https://aka.ms/vs/$msvcVersion/$channel/vs_buildtools.exe" +Write-Output "Downloading build tools from: $vsBtUrl" +Invoke-WebRequest -Uri $vsBtUrl -UseBasicParsing -OutFile .\vs_buildtools.exe -Invoke-WebRequest -Uri "https://aka.ms/vs/$msvcVersion/$channel/vs_buildtools.exe" -UseBasicParsing -OutFile .\vs_buildtools.exe -Write-Output "Installing components: $vsComponentString" -Start-Process -NoNewWindow -PassThru -Wait -FilePath .\vs_buildtools.exe -ArgumentList "install --installWhileDownloading --installPath $msvcPath --wait --norestart --nocache --quiet $requiredVsComponents" +Write-Output "Installing components: $requiredVsComponents" +Start-Process -NoNewWindow -PassThru -Wait -FilePath .\vs_buildtools.exe -ArgumentList "install --installWhileDownloading --installPath $msvcPath $components --wait --norestart --nocache --quiet" # Add VS to the global environment . "$PSScriptRoot/build-env.ps1" -vcver "$clVersion"