diff --git a/.github/workflows/build-test-windows.yml b/.github/workflows/build-test-windows.yml index 43cfe15ddc03..2a83cea31c98 100644 --- a/.github/workflows/build-test-windows.yml +++ b/.github/workflows/build-test-windows.yml @@ -111,6 +111,12 @@ jobs: working-directory: C:\vcpkg run: C:\vcpkg\vcpkg.exe integrate install + - name: Diagnostic — vcpkg installed tree + if: ${{ always() }} + shell: pwsh + continue-on-error: true + run: ./scripts/diagnostics/windows-vcpkg-tree.ps1 -Triplet "${{ matrix.vcpkg_triplet || 'x64-windows-meshlib' }}" + - name: Restore CUDA Cache uses: actions/cache@v5 id: cuda-cache @@ -213,6 +219,13 @@ jobs: call "${{matrix.vc-path}}\Common7\Tools\VsDevCmd.bat" -arch=amd64 ${{ fromJSON('["", "-vcvars_ver=14.2"]')[matrix.cxx_compiler == 'msvc-2019'] }} call ./scripts/mrbind/generate_win.bat -B --trace MODE=none VS_MODE=${{matrix.config}} + - name: Diagnostic — output bin DLL inventory + MRMesh imports + if: ${{ always() }} + shell: pwsh + continue-on-error: true + working-directory: source\x64\${{ matrix.config }} + run: ${{ github.workspace }}\scripts\diagnostics\windows-bin-imports.ps1 -VcPath "${{ matrix.vc-path }}" + - name: Run Start-and-Exit Tests timeout-minutes: 3 working-directory: source\x64\${{ matrix.config }} diff --git a/scripts/diagnostics/windows-bin-imports.ps1 b/scripts/diagnostics/windows-bin-imports.ps1 new file mode 100644 index 000000000000..50db742b2bbf --- /dev/null +++ b/scripts/diagnostics/windows-bin-imports.ps1 @@ -0,0 +1,45 @@ +# Before launching MeshViewer.exe, dump the state the Windows loader will +# actually see. Prints the DLLs present in the current directory, the +# import tables of the key binaries (so we know which DLL names the loader +# wants), and the PATH at launch. Lets DLL-not-found failures self-diagnose +# from the CI log. +# +# Run from the directory containing MeshViewer.exe / MRMesh.dll / MRTest.exe. +[CmdletBinding()] +param( + [Parameter(Mandatory = $true)][string]$VcPath +) + +Write-Host "=== DLLs / EXEs in $(Get-Location) ===" +Get-ChildItem . -File -Include *.dll,*.exe -Recurse -ErrorAction SilentlyContinue | + Select-Object Name, @{N='SizeKB';E={[int]($_.Length/1KB)}} | + Sort-Object Name | Format-Table -AutoSize + +# Locate dumpbin.exe via the VC path hint, then fall back to whatever is on +# PATH (Visual Studio Integration step earlier populates MSBuild PATH, not +# VC bin). +$dumpbin = (Get-ChildItem "$VcPath\VC\Tools\MSVC\*\bin\Hostx64\x64\dumpbin.exe" -ErrorAction SilentlyContinue | + Select-Object -First 1).FullName +if (-not $dumpbin) { + $dumpbin = (Get-Command dumpbin.exe -ErrorAction SilentlyContinue).Source +} + +if ($dumpbin) { + Write-Host "" + Write-Host "Using dumpbin at: $dumpbin" + foreach ($target in 'MeshViewer.exe','MRMesh.dll','MRTest.exe') { + if (Test-Path $target) { + Write-Host "" + Write-Host "=== Import table of $target (dumpbin /dependents) ===" + & $dumpbin /dependents $target | + Where-Object { $_ -match '\.dll$' } | + ForEach-Object { " " + $_.Trim() } + } + } +} else { + Write-Warning "dumpbin.exe not found; skipping import-table dump" +} + +Write-Host "" +Write-Host "=== PATH at diagnostic step ===" +$env:PATH -split ';' | ForEach-Object { " $_" } diff --git a/scripts/diagnostics/windows-vcpkg-tree.ps1 b/scripts/diagnostics/windows-vcpkg-tree.ps1 new file mode 100644 index 000000000000..567aa193adfb --- /dev/null +++ b/scripts/diagnostics/windows-vcpkg-tree.ps1 @@ -0,0 +1,22 @@ +# Inventory the vcpkg installed tree so DLL-not-found failures later in the +# build can be traced back to whether the DLL was (a) never installed, +# (b) installed under an unexpected name, or (c) installed fine but not +# copied to the build output. +[CmdletBinding()] +param( + [Parameter(Mandatory = $true)][string]$Triplet +) + +Write-Host "=== Triplet: $Triplet ===" +foreach ($sub in 'bin', 'debug\bin', 'lib', 'debug\lib') { + $dir = "C:\vcpkg\installed\$Triplet\$sub" + Write-Host "" + Write-Host "--- $dir ---" + if (Test-Path $dir) { + Get-ChildItem $dir -File -ErrorAction SilentlyContinue | + Select-Object Name, @{N='SizeKB';E={[int]($_.Length/1KB)}} | + Sort-Object Name | Format-Table -AutoSize + } else { + Write-Host "(directory not present)" + } +}