From eef6cb8061b3be28f942c9ff96b466aaf9f78aec Mon Sep 17 00:00:00 2001 From: JJenkx Date: Fri, 23 Oct 2026 04:59:00 -0400 Subject: [PATCH] test(libs): give patched_libraries the MinGW runtime on its PATH patched_libraries loads each patched .prx with LoadLibraryExW and LOAD_WITH_ALTERED_SEARCH_PATH, so Windows looks for the libraries' own dependencies (libstdc++-6.dll, libgcc_s_seh-1.dll, libwinpthread-1.dll) next to the .prx and then on PATH, not next to the test executable where the build copies the MinGW runtime. Run from a shell whose PATH does not start with the toolchain's bin, it failed with error 126 for libc.prx, libkernel.prx and the others, or loaded another libstdc++ found earlier on PATH. On MinGW, prepend the compiler's directory to the test's PATH, as the other tests do for the directories their libraries load from. Co-Authored-By: Claude Opus 5.5 --- core/libs/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/libs/CMakeLists.txt b/core/libs/CMakeLists.txt index dd6b40d1e4..b6075d5ca3 100644 --- a/core/libs/CMakeLists.txt +++ b/core/libs/CMakeLists.txt @@ -310,6 +310,11 @@ if(BUILD_TESTING) target_link_options(patched_libraries_tests PRIVATE -static -static-libgcc -static-libstdc++) endif() add_test(NAME patched_libraries COMMAND patched_libraries_tests ${PATCHED_DIR}) + if(MINGW) + get_filename_component(patchedLibrariesRuntimeDirectory "${CMAKE_CXX_COMPILER}" DIRECTORY) + set_tests_properties(patched_libraries PROPERTIES + ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:${patchedLibrariesRuntimeDirectory}") + endif() if(CMAKE_SYSTEM_NAME STREQUAL "Linux") add_library(host_libstdcxx_exception_module SHARED tests/HostLibstdcxxExceptionModule.cpp) target_link_libraries(host_libstdcxx_exception_module PRIVATE ${PATCHED_DIR}/libc.prx)