Skip to content

Commit 413ab81

Browse files
committed
build: fix silent vcvarsall.bat failure and add Claude Code build skills
Invoking vcvarsall.bat via Push-Location + relative name silently no-ops when the detected Visual Studio install is missing the C++ build tools workload: cmd.exe prints "'vcvarsall.bat' is not recognized" to stderr, the inner `set` still runs and dumps the existing environment, the ForEach loop re-sets the same env (no-op), and the script proceeds without VC env loaded. meson then fails with a cryptic "cl.exe not found" later in the build, hiding the real cause. The same bug exists in bridge/build_common.ps1::SetupVS. Resolve vcvarsall.bat by full path with an explicit Test-Path guard, and verify LIBPATH is set after the env-load loop. vcvarsall's exit code isn't propagated through the cmd-piped-into-ForEach construct, so the LIBPATH check is what catches the silent-failure case. Also add two Claude Code skill files under .claude/skills/ that document the canonical invocation of build_dxvk.ps1 (runtime) and bridge\build_bridge_release.bat (bridge) for LLM-driven contributor workflows. These do not change the build itself -- they only describe the existing entry points and what success and failure look like.
1 parent b43b840 commit 413ab81

4 files changed

Lines changed: 162 additions & 8 deletions

File tree

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
name: bridge-build
3+
description: Build the Remix Bridge (32-bit client d3d9 + 64-bit server NvRemixBridge) via bridge\build_bridge_release.bat (or its debug / debugoptimized siblings). Use when the user asks to build, compile, compile-check, or smoke-test the bridge specifically — the bridge is a separate component from the runtime. Reports exit code + verifies artifacts. Do NOT invoke for runtime-side edits (src/dxvk/).
4+
---
5+
6+
# bridge-build
7+
8+
The bridge is the IPC layer that lets a 32-bit game talk to the 64-bit
9+
Remix runtime. Client (32-bit `d3d9.dll`) and server (64-bit
10+
`NvRemixBridge.exe`) build into separate meson directories (one per
11+
arch). The `bridge\build_bridge_*.bat` wrappers internally call
12+
[`build_bridge.ps1`](../../../bridge/build_bridge.ps1) twice — once per arch.
13+
14+
## When to invoke
15+
16+
- User asks to build, compile, compile-check, or smoke-test the bridge
17+
- After a code change under `bridge/src/`
18+
- After a change to [`public/include/remix/remix_c.h`](../../../public/include/remix/remix_c.h)
19+
(the bridge consumes that header)
20+
- Before pushing bridge changes
21+
22+
## When NOT to invoke
23+
24+
- Edits only under `src/dxvk/` — invoke [`rtx-build`](../rtx-build/SKILL.md) instead
25+
- Doc-only changes
26+
- When the user asks for the main runtime build
27+
28+
## Steps
29+
30+
1. From the project root, kick off the bridge build with
31+
`run_in_background: true` (expected duration: ~30s incremental,
32+
2-4 min cold full for both arches):
33+
34+
```powershell
35+
.\bridge\build_bridge_release.bat
36+
```
37+
38+
For other flavors: `.\bridge\build_bridge_debug.bat`,
39+
`.\bridge\build_bridge_debugoptimized.bat`, or
40+
`.\bridge\build_bridge_all.bat` for all three.
41+
42+
2. Wait for the task-completion notification — do not poll.
43+
44+
3. Report back:
45+
- **Green (exit 0):** verify all three artifacts exist, then quote
46+
their paths and mtimes:
47+
- `bridge\_compRelease_x64\src\server\NvRemixBridge.exe` (x64 server)
48+
- `bridge\_compRelease_x86\src\client\d3d9.dll` (x86 client)
49+
- `bridge\_compRelease_x86\src\launcher\NvRemixLauncher32.exe` (x86 launcher)
50+
- **Mixed-mtime warning:** if x64 server and x86 client mtimes are
51+
from very different times, flag this — IPC ABI risk if shared
52+
command opcodes / structs under `bridge/src/util/` shifted between
53+
builds.
54+
- **Red (non-zero exit):** scan the captured output for
55+
`error C[0-9]`, `FAILED:`, or `ninja: build stopped`. Quote the
56+
first ~10 error lines verbatim.
57+
58+
## Flavors
59+
60+
| Flavor | x64 dir | x86 dir |
61+
|---|---|---|
62+
| release (default) | `_compRelease_x64` | `_compRelease_x86` |
63+
| debug | `_compDebug_x64` | `_compDebug_x86` |
64+
| debugoptimized | `_compDebugOptimized_x64` | `_compDebugOptimized_x86` |
65+
66+
## Notes
67+
68+
- Requires the MSVC v142 toolchain (VS2019, or VS2022 with the v142
69+
Individual Component installed).
70+
- The bridge can run standalone (without the main `dxvk-remix` runtime)
71+
— useful for IPC smoke tests, but no pathtracing.

.claude/skills/rtx-build/SKILL.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
name: rtx-build
3+
description: Build the dxvk-remix runtime (64-bit d3d9.dll) via build_dxvk.ps1. Use when the user asks to build, compile, compile-check, verify, or smoke-test the runtime. Runs in the background, reports exit code + verifies artifacts. Do NOT invoke for doc-only edits.
4+
---
5+
6+
# rtx-build
7+
8+
Wraps [`build_dxvk.ps1`](../../../build_dxvk.ps1), which dot-sources
9+
`build_common.ps1` for Visual Studio toolchain discovery and then calls
10+
`PerformBuild`. Runs in the background so the user isn't blocked, then
11+
reports the exit code and verifies the expected build artifact exists.
12+
13+
## When to invoke
14+
15+
- User asks to build, compile, compile-check, verify, or smoke-test the runtime
16+
- After a code change that touches `src/dxvk/` or other runtime sources
17+
- Before pushing runtime-side code changes
18+
19+
## When NOT to invoke
20+
21+
- Doc-only changes (`.md`, `documentation/`)
22+
- Settings / skill / config edits
23+
- Bridge-only changes — invoke [`bridge-build`](../bridge-build/SKILL.md) instead
24+
- Before the user has finished their code edits — building against a
25+
work-in-progress tree wastes time
26+
27+
## Steps
28+
29+
1. From the project root, kick off the build with `run_in_background: true`
30+
(expected duration: ~30s incremental, 10-15 min cold full):
31+
32+
```powershell
33+
.\build_dxvk.ps1 -Backend ninja -BuildFlavour release -BuildSubDir _Comp64Release -EnableTracy false
34+
```
35+
36+
For other flavors, see the table below.
37+
38+
2. Wait for the task-completion notification — do not poll.
39+
40+
3. Report back:
41+
- **Green (exit 0):** verify `_Comp64Release/src/d3d9/d3d9.dll` and
42+
`_output/d3d9.dll` exist, then quote their paths and mtimes.
43+
- **Red (non-zero exit):** scan the captured output for
44+
`error C[0-9]`, `fatal error`, `FAILED:`, or `ninja: build stopped`.
45+
Quote the first ~10 error lines so the user sees the real cause
46+
before any fix attempt.
47+
48+
## Flavors
49+
50+
| Flavor | `-BuildFlavour` | `-BuildSubDir` |
51+
|---|---|---|
52+
| release (default) | `release` | `_Comp64Release` |
53+
| debug | `debug` | `_Comp64Debug` |
54+
| debugoptimized | `debugoptimized` | `_Comp64DebugOptimized` |
55+
56+
## Notes
57+
58+
- `LNK4098: defaultlib 'LIBCMT' conflicts` is a known warning, not a failure.
59+
- The build produces `d3d9.dll` in `_Comp64Release/src/d3d9/` and installs
60+
it to `_output/`.
61+
- Requires the MSVC v142 toolchain (VS2019, or VS2022 with the v142
62+
Individual Component installed).

bridge/build_common.ps1

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,26 @@ function SetupVS {
5757
#If (Test-Path env:LIBPATH) {
5858
# Write-Host "Visual Studio Command Prompt variables already set." -ForegroundColor Yellow
5959
#} Else {
60-
# Load VC vars
61-
Push-Location "${vsPath}\VC\Auxiliary\Build"
60+
# Invoke vcvarsall.bat by full path so a missing C++ workload fails
61+
# loudly here rather than letting meson surface a cryptic "cl.exe not
62+
# found" downstream.
63+
$vcvarsall = Join-Path "${vsPath}\VC\Auxiliary\Build" "vcvarsall.bat"
64+
If (-not (Test-Path $vcvarsall)) {
65+
Write-Error "vcvarsall.bat not found at '$vcvarsall'. The detected Visual Studio installation may be missing the C++ build tools workload." -ErrorAction Stop
66+
}
6267

63-
cmd /c "vcvarsall.bat $Platform &set" |
68+
cmd /c "call `"$vcvarsall`" $Platform & set" |
6469
ForEach-Object {
6570
If ($_ -match "=") {
6671
$v = $_.split("="); Set-Item -Force -Path "ENV:\$($v[0])" -Value "$($v[1])"
6772
}
6873
}
69-
Pop-Location
74+
75+
# vcvarsall.bat doesn't propagate its own exit code through the pipe.
76+
# Use LIBPATH presence as the signal that the toolchain env loaded.
77+
If (-not (Test-Path env:LIBPATH)) {
78+
Write-Error "vcvarsall.bat ran but did not set LIBPATH; cannot continue." -ErrorAction Stop
79+
}
7080
Write-Host "Visual Studio Command Prompt variables set." -ForegroundColor Yellow
7181
#}
7282
}

build_common.ps1

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,15 @@ Write-Host "Using Visual Studio installation at: ${vsPath}" -ForegroundColor Yel
5252
If (Test-Path env:LIBPATH) {
5353
Write-Host "Visual Studio Command Prompt variables already set." -ForegroundColor Yellow
5454
} Else {
55-
# Load VC vars
56-
Push-Location "${vsPath}\VC\Auxiliary\Build"
57-
cmd /c "vcvarsall.bat x64&set" |
55+
# Invoke vcvarsall.bat by full path so a missing C++ workload fails
56+
# loudly here rather than letting meson surface a cryptic "cl.exe not
57+
# found" downstream.
58+
$vcvarsall = Join-Path "${vsPath}\VC\Auxiliary\Build" "vcvarsall.bat"
59+
If (-not (Test-Path $vcvarsall)) {
60+
Write-Error "vcvarsall.bat not found at '$vcvarsall'. The detected Visual Studio installation may be missing the C++ build tools workload." -ErrorAction Stop
61+
}
62+
63+
cmd /c "call `"$vcvarsall`" x64 & set" |
5864
ForEach-Object {
5965
# Due to some odd behavior with how powershell core (pwsh) (powershell 5.X not tested) interprets a specific
6066
# predefined gitlab CI variable (in this case CI_MERGE_REQUEST_DESCRIPTION) with a value that includes ===
@@ -65,7 +71,12 @@ If (Test-Path env:LIBPATH) {
6571
}
6672
}
6773
}
68-
Pop-Location
74+
75+
# vcvarsall.bat doesn't propagate its own exit code through the pipe.
76+
# Use LIBPATH presence as the signal that the toolchain env loaded.
77+
If (-not (Test-Path env:LIBPATH)) {
78+
Write-Error "vcvarsall.bat ran but did not set LIBPATH; cannot continue." -ErrorAction Stop
79+
}
6980
Write-Host "Visual Studio Command Prompt variables set." -ForegroundColor Yellow
7081
}
7182

0 commit comments

Comments
 (0)