From c13d3b474a36c96fa6a1fb308182570dac78e4de Mon Sep 17 00:00:00 2001 From: Arekatla Nishanth Chowdary Date: Mon, 12 Oct 2026 01:12:43 +0530 Subject: [PATCH] fix(build): reject MinGW compilers that select SjLj exceptions for the libraries The libraries are built with -fno-asynchronous-unwind-tables and unwind through their own DWARF tables. MinGW-w64 GCC 11.4 and 13.2 answer that flag by switching to SjLj exceptions. Configuration succeeded and, with 13.2, the build stopped at the libc.prx link with undefined references to __gxx_personality_sj0 and _Unwind_SjLj_Register, which does not name the cause. Configuration now checks the exception model the flag selects and stops with the supported toolchain's location. --- core/libs/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/libs/CMakeLists.txt b/core/libs/CMakeLists.txt index 2da76ed8e..453fa1829 100644 --- a/core/libs/CMakeLists.txt +++ b/core/libs/CMakeLists.txt @@ -26,6 +26,13 @@ target_compile_features(nid_patcher PRIVATE cxx_std_20) if(MINGW) target_link_options(nid_patcher PRIVATE -static -static-libgcc -static-libstdc++) + include(CheckCXXSourceCompiles) + set(CMAKE_REQUIRED_FLAGS -fno-asynchronous-unwind-tables) + check_cxx_source_compiles("#ifdef __USING_SJLJ_EXCEPTIONS__\n#error\n#endif\nint main() { return 0; }" ANYPS5_MINGW_DWARF_EXCEPTIONS) + unset(CMAKE_REQUIRED_FLAGS) + if(NOT ANYPS5_MINGW_DWARF_EXCEPTIONS) + message(FATAL_ERROR "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} selects SjLj exceptions with -fno-asynchronous-unwind-tables; the libraries need DWARF unwinding. Use the MinGW-w64 toolchain listed in docs/dev/BUILD.md.") + endif() add_compile_options(-fno-asynchronous-unwind-tables) endif()