Have a similar issue under linux (running on x86_64 so not cmake_pch_arm64.hxx.pch but cmake_pch.hxx.pch instead).
Turns out it was an issue with cmake. Using cmake 3.28.2 gives me this error and when I downgrade cmake to 3.28.1, it compiles fine.
CMake 3.28.2 was released 2 days ago. The most relevant change seems this one.
Some code got reordered, maybe that broke something when unity builds and precompiled headers are used together. In particular this looks suspicious, could explain a dependency on a pch file going missing:
- lg->AddUnityBuild(gt.get());
lg->AddISPCDependencies(gt.get());
// Targets that reuse a PCH are handled below.
if (!gt->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM")) {
lg->AddPchDependencies(gt.get());
}
I can repro on windows with the ninja generator, so it’s not platform or generator dependend by the looks of it. Disabling unity sidesteps the issue
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8369241155d..ae7828f6016 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -245,7 +245,8 @@ mark_as_advanced(CPACK_OVERRIDE_PACKAGENAME)
mark_as_advanced(BUILDINFO_OVERRIDE_DATE)
mark_as_advanced(BUILDINFO_OVERRIDE_TIME)
-if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16")
+# CMAKE 3.28.2 has issues with the combination of PCH and unity builds, disable for now.
+if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16" AND NOT ${CMAKE_VERSION} VERSION_EQUAL "3.28.2")
option(WITH_UNITY_BUILD "\
Enable unity build for modules that support it to improve compile times.\n\
WARNING: this option allows files to be built without all necessary headers!\n
make[3]: *** No rule to make target 'source/blender/compositor/CMakeFiles/bf_compositor.dir/cmake_pch.hxx.gch', needed by 'source/blender/compositor/CMakeFiles/bf_compositor.dir/Unity/unity_24_cxx.cxx.o'. Stop.
make[2]: *** [CMakeFiles/Makefile2:8137: source/blender/compositor/CMakeFiles/bf_compositor.dir/all] Error 2