I am facing very strange issue on the last version of Xcode. At some point during heavy build (like building QtWebEngine from the sources) some headers from MacOSX SDK may disappear for the compiler, what leads to the errors. The issue happens build to build. I haven't found any other issue even close to be similar anywhere.
The errors during the build looks like this:
../../../../../../../../../../../Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -MMD -MF obj/pdf/internal/pdfium_permissions.o.d -DOFFICIAL_BUILD -DTOOLKIT_QT -D_LIBCPP_HAS_NO_ALIGNED_ALLOCATION -DCR_XCODE_VERSION=1510 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DWEBP_EXTERN=extern -DUSE_EGL -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DUSE_CHROMIUM_ICU=1 -DU_ENABLE_TRACING=1 -DU_ENABLE_RESOURCE_TRACING=0 -DU_STATIC_IMPLEMENTATION -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE -DUCHAR_TYPE=uint16_t -DV8_COMPRESS_POINTERS -DV8_31BIT_SMIS_ON_64BIT_ARCH -DV8_DEPRECATION_WARNINGS -DV8_REVERSE_JSARGS -DGOOGLE_PROTOBUF_NO_RTTI -DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER -DHAVE_PTHREAD -DSK_CODEC_DECODES_PNG -DSK_CODEC_DECODES_WEBP -DSK_ENCODE_PNG -DSK_ENCODE_WEBP -DSK_USER_CONFIG_HEADER=\"../../skia/config/SkUserConfig.h\" -DSK_GL -DSK_CODEC_DECODES_JPEG -DSK_ENCODE_JPEG -DSK_USE_LIBGIFCODEC -DSK_SUPPORT_GPU=1 -DSK_GPU_WORKAROUNDS_HEADER=\"gpu/config/gpu_driver_bug_workaround_autogen.h\" -DSK_BUILD_FOR_MAC -DSK_METAL -DPDF_ENABLE_V8 -DPDFIUM_PRINT_TEXT_WITH_GDI -DFT_CONFIG_MODULES_H=\"freetype-custom/freetype/config/ftmodule.h\" -DFT_CONFIG_OPTIONS_H=\"freetype-custom/freetype/config/ftoption.h\" -DPDFIUM_REQUIRED_MODULES -DCHROMIUM_RESTRICT_VISIBILITY -Igen -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/pdfium -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/perfetto/include -Igen/third_party/perfetto/build_config -Igen/third_party/perfetto -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/libwebp/src -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/libyuv/include -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/jsoncpp/source/include -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/khronos -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/gpu -Igen/third_party/dawn/src/include -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/dawn/src/include -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/abseil-cpp -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/include -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/protobuf/src -Igen/protoc_out -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/ced/src -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/icu/source/common -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/icu/source/i18n -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/v8/include -Igen/v8/include -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/protobuf/src -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/skia -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/libgifcodec -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/freetype/include -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/freetype/include/freetype-custom -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/freetype/src/include -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/harfbuzz-ng/src/src -fno-strict-aliasing -fstack-protector -Wno-unknown-attributes -Wno-unknown-pragmas -Wno-unknown-warning-option -fcolor-diagnostics -fmerge-all-constants -arch x86_64 -Wall -Wextra -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wimplicit-fallthrough -Wunreachable-code -Wthread-safety -Wextra-semi -Wunguarded-availability -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-unneeded-internal-declaration -Wno-undefined-var-template -Wno-psabi -Wno-ignored-pragma-optimize -Wno-implicit-int-float-conversion -Wno-final-dtor-non-final-class -Wno-builtin-assume-aligned-alignment -Wno-deprecated-copy -Wno-non-c-typedef-for-linkage -Wno-max-tokens -O2 -fno-omit-frame-pointer -g0 -isysroot ../../../../../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk -mmacosx-version-min=10.13 -fvisibility=hidden -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wshadow -Wno-shorten-64-to-32 -Wno-parentheses-equality -Wno-tautological-compare -Wno-thread-safety-attributes -Wno-undefined-bool-conversion -Wno-tautological-undefined-compare -std=c++14 -fno-trigraphs -Wno-trigraphs -stdlib=libc++ -fno-exceptions -fno-rtti -fvisibility-inlines-hidden -Wno-deprecated-declarations -c ../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/pdf/pdfium/pdfium_permissions.cc -o obj/pdf/internal/pdfium_permissions.o
In file included from ../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/pdf/pdfium/pdfium_permissions.cc:5:
In file included from ../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/pdf/pdfium/pdfium_permissions.h:8:
In file included from ../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/pdf/pdf_engine.h:10:
../../../../../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/memory:899:10: fatal error: '__memory/temporary_buffer.h' file not found
Failed single commands in proper environment never fails. Errors occur only during really big build.
I've opened a bug (https://bugreports.qt.io/browse/QTBUG-119115) in Qt bug tracker. But it seems to be more like a clang bug, because this can happen during any heavy build on 2 different machines (x64 and arm64).
There was a suggestion about reaching the limit of opened files. This shouldn't be the case, as clang opens only small amount of them (up to 20 I guess), but I can be wrong.