Skip to content

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

Open
Tauwni wants to merge 6 commits into
ProjectLeonida:mainfrom
Tauwni:fix/null-descriptor-generated-dir

Conversation

@Tauwni

@Tauwni Tauwni commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: #1608 (comment)

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:

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.

…ngValidator writes into it

On a fresh macOS or Linux build tree nothing has made generated/ when this
rule runs, so glslangValidator stops with "Failed to open file" and the build
of vk_null_descriptor_test fails (and every test after it in ctest).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Tauwni

Tauwni commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

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 and others added 2 commits November 27, 2026 09:49
… it can run first

From wavehs's finding in ProjectLeonida#1608: the per-rule make_directory covered only the
null-descriptor shader, and the other generated/*.spv rules relied on being
ordered after a rule that made the folder. A fresh -j8 build on macOS now
goes through without Failed to open file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Tauwni

Tauwni commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

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 Andretuta left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Tauwni Tauwni changed the title cmake: vk_null_descriptor_test's rule creates generated/ before glslangValidator writes into it (BUILD-NULL-DESCRIPTOR-GENERATED-DIR) 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) Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants