From 8eb2efa6ca8d11c7e742efc1554b6e8cf00ffc5c Mon Sep 17 00:00:00 2001 From: James Dansereau <106631954+jkdansereau@users.noreply.github.com> Date: Wed, 2 Sep 2026 22:16:20 -0400 Subject: [PATCH] linux-build: resolve host via -print-file-name is compiler-internal (lib/gcc///include), not in bin/../include on a native Linux GCC, so the MinGW-layout guess produced /usr/include/stddef.h which does not exist -> fatal error in every fast3d C++ TU. Ask the compiler with -print-file-name=include/stddef.h and fall back to the old path. MinGW resolves to its own lib/gcc internal copy; Windows build verified green (240/241). --- CMakeLists.txt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1189b786..cc7a56d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -164,7 +164,17 @@ configure_file( # Host path for port/shim/stddef.h (same reason as stdlib: the N64 # stub shadows the host header in C++ TUs, hiding max_align_t from cstddef). -get_filename_component(PORT_HOST_STDDDEF_H "${_PORT_GCC_DIR}/../include/stddef.h" ABSOLUTE) +# stddef.h is compiler-internal, not in bin/../include: on a native Linux GCC +# it lives under lib/gcc///include. Ask the compiler where it is; +# fall back to the MinGW bin/../include layout. +execute_process( + COMMAND "${CMAKE_C_COMPILER}" -print-file-name=include/stddef.h + OUTPUT_VARIABLE _PORT_GCC_STDDEF OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) +if(_PORT_GCC_STDDEF AND EXISTS "${_PORT_GCC_STDDEF}") + get_filename_component(PORT_HOST_STDDDEF_H "${_PORT_GCC_STDDEF}" ABSOLUTE) +else() + get_filename_component(PORT_HOST_STDDDEF_H "${_PORT_GCC_DIR}/../include/stddef.h" ABSOLUTE) +endif() configure_file( "${CMAKE_SOURCE_DIR}/port/include/hoststddef.h.in" "${CMAKE_BINARY_DIR}/port/include/hoststddef.h" @ONLY)