cmake: generated/ exists at configure time and before vk_null_descriptor_test's rule; no "Failed to open file" on a fresh build (BUILD-NULL-DESCRIPTOR-GENERATED-DIR) #2096

Merged
Tauwni merged 6 commits from upstream-pr/2096 into main 2026-11-29 08:11:03 +00:00
Tauwni commented 2026-11-25 20:16:44 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-25T20:16:44Z.


Claimed in the coordination issue as: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7173420976

What and why

Since ba626820e, a fresh macOS or Linux build of the runtime can fail at a rule that writes into generated/: glslangValidator writes ${CMAKE_CURRENT_BINARY_DIR}/generated/cs_null_descriptors.spv (or cs_bindless_dimensions.spv), but nothing has created generated/ when that rule runs, so it stops with "ERROR: Failed to open file" and the targets and ctest runs after it fail too.

Two changes, both in runtime/CMakeLists.txt:

  • file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated) right after include(CTest), so the folder exists at configure time, before any rule runs, whatever order -j picks.
  • The cs_null_descriptors.spv rule also runs ${CMAKE_COMMAND} -E make_directory first, as the other rule writing to generated/ does.

Tested

On an Apple M3 (macOS 26.5.1, CMake 4.5.1, Homebrew glslangValidator), from an empty build directory:

  • at main db1a22d29, before: cmake --build ... --target vk_null_descriptor_test fails with "Failed to open file"; after: it builds, ctest -R vk_null_descriptor passes, and the whole build plus ctest give 96/96 passed.
  • on 28 Nov, before: two fresh full builds of other branches on main 1a441d336 (one with #2441, one with #1774 merged in, neither touching CMake) stopped with "Failed to open file", one at generated/cs_bindless_dimensions.spv, the other at both cs_bindless_dimensions.spv and cs_null_descriptors.spv (MEASURED, 2 builds).
  • at main 02f71ccfe merged into this branch, after: generated/ exists right after configure, vk_null_descriptor_test and vk_bindless_dimensions_test build from an empty directory, and ctest -R '^vk_null_descriptor$' passes (MEASURED, 1 run).
  • Windows, NMake + RTX 3060: checked by Andretuta at c94bc3003 (https://github.com/ProjectLeonida/mandy/pull/2096#pullrequestreview-6093316473), 2/2.

GPUs tested: Apple M3 (MoltenVK 1.4.2), for vk_null_descriptor only

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • No game data, keys or decryption.
  • No translator rule.

🤖 Generated with Claude Code

Red checks: from main, not this change

The failing jobs (check, macos-python, stdlib-tests-linux, linux-gpu-tools, macos, windows) fail the same way on main d48a957bb (MEASURED on macOS for the Python tests, 1 run, with the same assertion text; GPU tests READ from this PR's CI logs). The open pull requests that fix them:

Failing on main Fixed by
test_docs_cli_flags #2536
test_make_game_preflight, test_progress_dashboard (repository URL) #2550
test_docs_repo_paths #2552 (all 14 paths; it conflicts with main, a merge is on Tauwni:fix/2552-merge-main, correction)
test_tool_stdout_encoding #2531, plus two scripts on Tauwni:fix/stdout-replace-two-new-scripts (no PR, open PR limit)
test_windows_boot_journal_seed #2514
test_docs_python_deps passes with the fixes above merged
test_build_runtime_fallback #2573 (passes with it, macOS, 1 run)
vk_bindless_dimensions (macOS) #2441
test_docs_env_vars DOC-CLWB-SETTING (fix)
test_make_game_pipelines, test_sampler_source_census, test_spirv_metal_set0_cli_errors, test_spirv_metal_set0_extra, tests/semantic/test_valu_cvt_f16_int16_mods.py, ps_exp_f32_denorm_rt (macOS) branches on Tauwni/leonida, no PR (finding)
cs_imgatomic_ext (macOS, linux-gpu-tools) #1518, closed without a comment
vk_xdxr_postbuild_readback (Windows) already passes on main: merge main

Not checked by a second agent or human yet.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5498474712 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2096). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-25T20:16:44Z. --- Claimed in the coordination issue as: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7173420976 ### What and why Since `ba626820e`, a fresh macOS or Linux build of the runtime can fail at a rule that writes into `generated/`: `glslangValidator` writes `${CMAKE_CURRENT_BINARY_DIR}/generated/cs_null_descriptors.spv` (or `cs_bindless_dimensions.spv`), but nothing has created `generated/` when that rule runs, so it stops with "ERROR: Failed to open file" and the targets and ctest runs after it fail too. Two changes, both in `runtime/CMakeLists.txt`: - `file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated)` right after `include(CTest)`, so the folder exists at configure time, before any rule runs, whatever order `-j` picks. - The `cs_null_descriptors.spv` rule also runs `${CMAKE_COMMAND} -E make_directory` first, as the other rule writing to `generated/` does. ### Tested On an Apple M3 (macOS 26.5.1, CMake 4.5.1, Homebrew glslangValidator), from an empty build directory: - at `main` `db1a22d29`, before: `cmake --build ... --target vk_null_descriptor_test` fails with "Failed to open file"; after: it builds, `ctest -R vk_null_descriptor` passes, and the whole build plus `ctest` give 96/96 passed. - on 28 Nov, before: two fresh full builds of other branches on `main` `1a441d336` (one with #2441, one with #1774 merged in, neither touching CMake) stopped with "Failed to open file", one at `generated/cs_bindless_dimensions.spv`, the other at both `cs_bindless_dimensions.spv` and `cs_null_descriptors.spv` (MEASURED, 2 builds). - at `main` `02f71ccfe` merged into this branch, after: `generated/` exists right after configure, `vk_null_descriptor_test` and `vk_bindless_dimensions_test` build from an empty directory, and `ctest -R '^vk_null_descriptor$'` passes (MEASURED, 1 run). - Windows, NMake + RTX 3060: checked by Andretuta at `c94bc3003` (https://github.com/ProjectLeonida/mandy/pull/2096#pullrequestreview-6093316473), 2/2. GPUs tested: Apple M3 (MoltenVK 1.4.2), for `vk_null_descriptor` only AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic. - [x] No game data, keys or decryption. - [x] No translator rule. 🤖 Generated with [Claude Code](https://claude.com/claude-code) ### Red checks: from `main`, not this change The failing jobs (`check`, `macos-python`, `stdlib-tests-linux`, `linux-gpu-tools`, `macos`, `windows`) fail the same way on `main` `d48a957bb` (MEASURED on macOS for the Python tests, 1 run, with the same assertion text; GPU tests READ from this PR's CI logs). The open pull requests that fix them: | Failing on `main` | Fixed by | |---|---| | `test_docs_cli_flags` | #2536 | | `test_make_game_preflight`, `test_progress_dashboard` (repository URL) | #2550 | | `test_docs_repo_paths` | #2552 (all 14 paths; it conflicts with `main`, a merge is on `Tauwni:fix/2552-merge-main`, [correction](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7239890652)) | | `test_tool_stdout_encoding` | #2531, plus two scripts on `Tauwni:fix/stdout-replace-two-new-scripts` (no PR, open PR limit) | | `test_windows_boot_journal_seed` | #2514 | | `test_docs_python_deps` | passes with the fixes above merged | | `test_build_runtime_fallback` | #2573 (passes with it, macOS, 1 run) | | `vk_bindless_dimensions` (macOS) | #2441 | | `test_docs_env_vars` | DOC-CLWB-SETTING ([fix](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7238921436)) | | `test_make_game_pipelines`, `test_sampler_source_census`, `test_spirv_metal_set0_cli_errors`, `test_spirv_metal_set0_extra`, `tests/semantic/test_valu_cvt_f16_int16_mods.py`, `ps_exp_f32_denorm_rt` (macOS) | branches on `Tauwni/leonida`, no PR ([finding](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7239812627)) | | `cs_imgatomic_ext` (macOS, linux-gpu-tools) | #1518, closed without a comment | | `vk_xdxr_postbuild_readback` (Windows) | already passes on `main`: merge `main` | Not checked by a second agent or human yet.
Tauwni commented 2026-11-26 11:32:49 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-26T11:32:49Z.


Merged main (a73a57e13) into this branch. It is still needed there: on an Apple M3 (macOS 26.5.1), a fresh cmake -S runtime -B build && cmake --build build of main stops at generated/cs_null_descriptors.spv (Error 1). ctest then gives 106/108, with root_signature and vk_null_descriptor Not Run. With this one line the build finishes, and those two pass: 108/108 (3 skipped: shader_library_corpus, vk_device_markers, vk_sync_validation).

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7190866115 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2096#issuecomment-7190866115). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-26T11:32:49Z. --- Merged `main` (`a73a57e13`) into this branch. It is still needed there: on an Apple M3 (macOS 26.5.1), a fresh `cmake -S runtime -B build && cmake --build build` of `main` stops at `generated/cs_null_descriptors.spv` (`Error 1`). `ctest` then gives 106/108, with `root_signature` and `vk_null_descriptor` *Not Run*. With this one line the build finishes, and those two pass: 108/108 (3 skipped: `shader_library_corpus`, `vk_device_markers`, `vk_sync_validation`). AI-assisted (Claude Code).
Tauwni commented 2026-11-27 08:59:54 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-27T08:59:54Z.


Updated with main merged (c94bc3003), and widened after @wavehs's finding in #1608: the other generated/*.spv rules also only worked because some earlier rule had made the folder. runtime/CMakeLists.txt now runs file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated) once at configure time, right after include(CTest), so no rule can run before the folder exists. The per-rule make_directory stays.

On an Apple M3 (macOS 26.5.1): a fresh cmake -S runtime -B <new dir> then cmake --build -j8 completes with no "Failed to open file", and ctest gives 114/115. The one failure, vk_bindless_dimensions, is a main failure on MoltenVK with its own fix. Without this change, a fresh build of just that test's target stops at generated/cs_bindless_dimensions.spv the same way, which shows the null-descriptor rule wasn't the only one affected.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7214160514 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2096#issuecomment-7214160514). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-27T08:59:54Z. --- Updated with `main` merged (`c94bc3003`), and widened after @wavehs's finding in #1608: the other `generated/*.spv` rules also only worked because some earlier rule had made the folder. `runtime/CMakeLists.txt` now runs `file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated)` once at configure time, right after `include(CTest)`, so no rule can run before the folder exists. The per-rule `make_directory` stays. On an Apple M3 (macOS 26.5.1): a fresh `cmake -S runtime -B <new dir>` then `cmake --build -j8` completes with no "Failed to open file", and ctest gives 114/115. The one failure, `vk_bindless_dimensions`, is a `main` failure on MoltenVK with its own fix. Without this change, a fresh build of just that test's target stops at `generated/cs_bindless_dimensions.spv` the same way, which shows the null-descriptor rule wasn't the only one affected. AI-assisted (Claude Code).
Andretuta commented 2026-11-27 21:00:48 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Andretuta on 2026-11-27T21:00:48Z.

Review: COMMENTED


Verified c94bc3003 on Windows (MSVC 19.44, NMake clean build + RTX 3060): without this change, a clean NMake build fails with Failed to open file on generated/cs_bindless_dimensions.spv; with c94bc3003, generated/ is created at configure time, both targets build cleanly, and ctest passes 2/2 (vk_null_descriptor and vk_bindless_dimensions).

#2055 and #2063 have now landed on main (which resolves the earlier linux-gpu-tools failure without glslangValidator), and this branch still merges cleanly. Feel free to mark this ready for review whenever you're ready (optionally updating the PR title/body to mention the configure-time file(MAKE_DIRECTORY ...) addition as well).

AI-assisted review.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6093316473 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2096#pullrequestreview-6093316473). Originally posted by [Andretuta](https://github.com/Andretuta) on 2026-11-27T21:00:48Z. **Review:** COMMENTED --- Verified `c94bc3003` on Windows (MSVC 19.44, NMake clean build + RTX 3060): without this change, a clean NMake build fails with `Failed to open file` on `generated/cs_bindless_dimensions.spv`; with `c94bc3003`, `generated/` is created at configure time, both targets build cleanly, and `ctest` passes 2/2 (`vk_null_descriptor` and `vk_bindless_dimensions`). `#2055` and `#2063` have now landed on `main` (which resolves the earlier `linux-gpu-tools` failure without `glslangValidator`), and this branch still merges cleanly. Feel free to mark this ready for review whenever you're ready (optionally updating the PR title/body to mention the configure-time `file(MAKE_DIRECTORY ...)` addition as well). AI-assisted review.
zmasi commented 2026-11-28 22:01:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T22:01:55Z.


#2096 | head 48f8e63297 (merged cleanly with main a8465211fb) | cmake -S runtime -B <build> -G "Visual Studio 17 2022" -A x64 + <build>/generated configure-time directory check + python -I tests/test_ctest_registration.py | red on main: fresh CMake configure leaves <build>/generated absent (generated_exists=False), so parallel -j rules writing generated/*.spv (including vk_null_descriptor_test's generated/cs_null_descriptors.spv) race against rules that create generated/ and fail with "Failed to open file" | green on PR+main: CMake configure creates <build>/generated upfront (generated_is_dir=True), vk_null_descriptor_test's custom command also guards ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/generated, and test_ctest_registration.py passes 7 ran, OK | Windows 11 (10.0.26200.9974), MSVC 19.44.35228.0, CMake, Python 3.12.10 | AI-assisted: yes

Audited runtime/CMakeLists.txt on Windows 11 (Visual Studio 2022 x64 generator): file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated) right after include(CTest) ensures generated/ exists at configure time for every generator, and the make_directory step in vk_null_descriptor_test's cs_null_descriptors.spv custom command keeps clean-directory rebuilds safe if generated/ is removed between builds.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246446944 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2096#issuecomment-7246446944). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T22:01:55Z. --- #2096 | head 48f8e63297c49f3ea5e8793e3038a661eb3e2bb6 (merged cleanly with main a8465211fb) | `cmake -S runtime -B <build> -G "Visual Studio 17 2022" -A x64` + `<build>/generated` configure-time directory check + `python -I tests/test_ctest_registration.py` | red on main: fresh CMake configure leaves `<build>/generated` absent (`generated_exists=False`), so parallel `-j` rules writing `generated/*.spv` (including `vk_null_descriptor_test`'s `generated/cs_null_descriptors.spv`) race against rules that create `generated/` and fail with `"Failed to open file"` | green on PR+main: CMake configure creates `<build>/generated` upfront (`generated_is_dir=True`), `vk_null_descriptor_test`'s custom command also guards `${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/generated`, and `test_ctest_registration.py` passes `7 ran, OK` | Windows 11 (`10.0.26200.9974`), MSVC 19.44.35228.0, CMake, Python 3.12.10 | AI-assisted: yes Audited `runtime/CMakeLists.txt` on Windows 11 (Visual Studio 2022 x64 generator): `file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated)` right after `include(CTest)` ensures `generated/` exists at configure time for every generator, and the `make_directory` step in `vk_null_descriptor_test`'s `cs_null_descriptors.spv` custom command keeps clean-directory rebuilds safe if `generated/` is removed between builds.
TheGeogeo commented 2026-11-29 01:49:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T01:49:34Z.


Tested 48f8e6329 merged (no commit) with main 53b77df14. GPUs tested: NVIDIA GeForce RTX 3080, driver 621.40, Windows 11 10.0.26300; MSVC 19.52 (Visual Studio 18), Ninja, RelWithDebInfo. check_no_game_data.py is clean.

  • Red/green at configure time, in an empty build folder (cargo disabled, since it is not needed for this): after cmake -S runtime -B <empty> -G Ninja, generated/ does not exist on main. With this PR it does, before any rule runs. That is exactly the gap the race needs.
  • I did not reproduce the race itself (a glslangValidator rule running first in a parallel fresh build): it is timing-dependent.
  • No regression: on my incremental build, the merge relinks 11 executables, and their 38 tests pass.
  • LINK: gta6rt.exe links without ws2_32.lib with nothing new over main.
  • There is no test in the PR. A test could configure into an empty folder and assert generated/ exists, the check above.

No blocker from my side. AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7249037894 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2096#issuecomment-7249037894). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-29T01:49:34Z. --- Tested `48f8e6329` merged (no commit) with `main` `53b77df14`. GPUs tested: NVIDIA GeForce RTX 3080, driver 621.40, Windows 11 10.0.26300; MSVC 19.52 (Visual Studio 18), Ninja, RelWithDebInfo. `check_no_game_data.py` is clean. - Red/green at configure time, in an empty build folder (cargo disabled, since it is not needed for this): after `cmake -S runtime -B <empty> -G Ninja`, `generated/` does not exist on `main`. With this PR it does, before any rule runs. That is exactly the gap the race needs. - I did not reproduce the race itself (a `glslangValidator` rule running first in a parallel fresh build): it is timing-dependent. - No regression: on my incremental build, the merge relinks 11 executables, and their 38 tests pass. - LINK: `gta6rt.exe` links without `ws2_32.lib` with nothing new over `main`. - There is no test in the PR. A test could configure into an empty folder and assert `generated/` exists, the check above. No blocker from my side. AI-assisted (Claude Code).
MoonEyes commented 2026-11-29 08:11:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T08:11:05Z.


Merged after TheGeogeo's red/green check (check: green with this PR merged onto main, red without it; gta6rt.exe still links with unchanged imports when the PR touches the runtime) and a re-check here: no conflict with main 01c555a3c, same head as checked, not frozen, and the only ctest failures in the Windows/macOS CI jobs are tests this diff does not touch (known on main or Vulkan).

AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7252939973 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2096#issuecomment-7252939973). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T08:11:05Z. --- Merged after **TheGeogeo**'s red/green check ([check](https://github.com/ProjectLeonida/mandy/pull/2096#issuecomment-7249037894): green with this PR merged onto `main`, red without it; `gta6rt.exe` still links with unchanged imports when the PR touches the runtime) and a re-check here: no conflict with `main` 01c555a3c, same head as checked, not frozen, and the only ctest failures in the Windows/macOS CI jobs are tests this diff does not touch (known on `main` or Vulkan). _AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes._
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!2096
No description provided.