fix(build): stage linked prx runtimes next to Windows test executables #8043
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8043"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by plokmklo on 2026-10-19T18:39:56Z.
What
A test whose executable imports a
.prxbut whoseadd_testregistration lacks the WIN32ENVIRONMENT_MODIFICATIONPATH prepend never reachesmain(): the loader resolveslib*.prximports to the patched copy inlibs/(or fails to find one), shows0xC0000139on a modal dialog, and ctest reports a timeout instead of a readable failure. The prepend is manual boilerplate repeated ~570 times across ~95 CMakeLists.txt files, every new registration must remember it, and Linux/macOS authors cannot see the breakage (rpath covers them).add_test_executablenow stages every linked prx runtime artifact next to the test executable viaRUNTIME_OUTPUT/$<TARGET_RUNTIME_DLLS:...>on Windows (guarded to CMake >= 3.21; older CMake keeps today's behaviour). The executable's own directory outranksPATHin the Windows DLL search order, so a missing prepend stops mattering, the modal-dialog hang disappears, and hand-running a test exe needs no environment setup. ExistingENVIRONMENT_MODIFICATIONprepends stay harmless.Tested
Ubuntu 24.04: full configure + the libkernel/avplayer/relinker test targets build and pass unchanged on Linux (the branch is a no-op there by construction). The Windows behaviour is exactly the mechanism proposed in #7637 and cannot be exercised in this sandbox; CI's Windows matrix is the verification.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-19T21:40:45Z.
The overlap with #7645 appears substantive: both PRs address #7637 by staging linked
.prxruntimes beside Windows test executables fromadd_test_executable. #7645 is still open, includes a CMake 3.21 gate with the older PATH behavior retained below that version, and has reported Windows direct-run and test-suite coverage. Could you update the PR body to acknowledge this overlap and clarify the intended coordination or any behavior this PR adds beyond #7645? The current body also leavesDepends onandUnblocksunchecked, and the latest conventions check is failing.Imported from boykopovar/AnyPS5. Originally posted by wachi35676 on 2026-10-19T23:17:57Z.
Verdict: defect (the change has no effect)
RUNTIME_OUTPUTis not a CMake target property, soset_target_properties(... RUNTIME_OUTPUT "$<TARGET_RUNTIME_DLLS:...>")only stores a user property that nothing reads. No DLL is staged next to the test executable.cmake --help-property-list(CMake 4.3.1) has noRUNTIME_OUTPUTentry.$<TARGET_RUNTIME_DLLS>only takes effect when a command uses it, for example aPOST_BUILDcopy orinstall(FILES ...).Reproduced on Windows 11 Home 10.0.26300 with WinLibs GCC 15.2.0 r7, CMake 4.3.1 and Ninja. The test project has a
SHAREDlibrarylibdep.prxwithRUNTIME_OUTPUT_DIRECTORY libs/, and an executabletintests/that links it. The executable gets the exact block from this PR:tests/after buildtests/t.exeRUNTIME_OUTPUTproperty onlyt.exelibdep.prx: cannot open shared object fileadd_custom_command(TARGET t POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_RUNTIME_DLLS:t> $<TARGET_FILE_DIR:t> COMMAND_EXPAND_LISTS)libdep.prx,t.exeThe PR says Windows behaviour "cannot be exercised in this sandbox" and leaves verification to CI. CI still passes because every existing test has the
ENVIRONMENT_MODIFICATIONPATH prepend, so CI cannot show whether this change works. A test registration without the prepend still behaves as described in #7637.A
POST_BUILDcopy as in the second row does what the PR describes for this case. Executables that link no.prxwould give it an empty list, which needs handling.AI-assisted: yes (Claude Code); results above were run on this machine.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T04:39:10Z.
@plokmklo thanks for picking up #7637. Unfortunately the new line doesn't stage anything:
RUNTIME_OUTPUTisn't a CMake property (cmake --help-property RUNTIME_OUTPUTsays so; the real ones areRUNTIME_OUTPUT_DIRECTORYandRUNTIME_OUTPUT_NAME).set_target_propertiesstores an unknown name as a user property without complaint, so the$<TARGET_RUNTIME_DLLS:...>value is never used.I checked it with a small project cross-built for Windows with llvm-mingw (a SHARED dependency with a
.prxsuffix, plus a test executable in the same shape asadd_test_executable). With this PR's line, the test directory holds only the.exe. With the copy that CMake'sTARGET_RUNTIME_DLLSdocumentation describes, the.prxlands next to it:Two things to watch:
copy_if_different <dir>, which fails. Use-E copy -t <dir> ...(CMake 3.26+), or wrap the command in$<$<BOOL:$<TARGET_RUNTIME_DLLS:${target}>>:...>.TARGET_FILE_DIRof libkernel and the others), not the patched copy inlibs/that #7637 says causes 0xC0000139.A Windows test that passes without the PATH prepend would show the fix works.
Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-25T07:41:02Z.
Review: CHANGES_REQUESTED
Reviewed
8187dbafdaf967188067be8bd0dfe01a82894957against author merge basee90a1d180268a1135ae70748c661a2830ce3f8ec.Changes requested: the added target property does not stage any runtime dependencies.
CMakeLists.txt:19 — consume TARGET_RUNTIME_DLLS in a real staging command. RUNTIME_OUTPUT is not a CMake runtime-copy property. Setting this custom property to a generator expression does not add a build rule, change the executable directory or copy a DLL. There is no project consumer for this property. Windows tests therefore still lack their linked .prx dependencies despite this patch's stated purpose. Add an appropriate post-build copy/staging operation with correct list/empty-list handling and test both linked and standalone executables.
Validation: CMake 4.3.1 identifies RUNTIME_OUTPUT as an unknown property. Disposable Windows projects used each revision's exact add_test_executable helper and WindowsTestExit wrapper, with a linked .prx emitted to a different directory (paths contain spaces). Both builds succeeded but neither staged the dependency; linked executables exited 0xC0000135. Manually copying only the .prx made both executables exit0. This demonstrates a no-op proposed fix, not a newly introduced missing-DLL regression. Conventions/whitespace passed; this older registration CLI does not support --scripts. No production source was amended; the manual copy is a reviewer fixture control.
Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-27T09:33:56Z.
Review: COMMENTED
Reviewed
238f7d8e7d— comment; the earlier no-op finding is fixed in the tested fixture.With the exact updated helper and WindowsTestExit wrapper, CMake 4.3.3 / GCC 15.3 / Ninja built a linked executable and a standalone executable in a path containing spaces. The linked .prx was copied from a separate output directory and both executables exited 0; the old reviewed head did not stage it. The empty dependency list also built successfully.
The hosted Windows job merged this head but skipped the product build and CTest steps, so it does not establish full-project runtime coverage. Please update the description: it still says RUNTIME_OUTPUT and CMake >= 3.21, whereas the patch uses a POST_BUILD copy guarded at 3.26. The Depends on and Unblocks checklist items also remain unchecked.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T07:09:14Z.
Review: APPROVED
Reviewed — looks good
The reviewed change adds a Windows post-build copy of linked runtime DLLs for test executables; the source change is limited to
CMakeLists.txtat head238f7d8e7dc223c8b6ee4bcf4ec4d75670fd1198.What I ran
Read the prepared PR description, commits, manifest, diff, and the changed top-level
CMakeLists.txt; searched foradd_test_executableand the runtime DLL staging code withrepo_read.py. No build or tests were run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
files.jsonwas unavailable, so exclusions by rule were not independently checked.To get this to a good state
Nothing is required.
Pull request closed