Build on MacOS is failing for me on main branch

I’m running on MacOS Sonoma 14.2.1 (23C71). Build is breaking around here…

[ 60%] Linking CXX static library ../../../lib/libbf_gpu.a
[ 60%] Built target bf_gpu
[ 60%] Linking CXX static library ../../../../lib/libbf_rna.a
[ 60%] Built target bf_rna
make[3]: *** No rule to make target `source/blender/compositor/CMakeFiles/bf_compositor.dir/cmake_pch_arm64.hxx.pch', needed by `source/blender/compositor/CMakeFiles/bf_compositor.dir/Unity/unity_24_cxx.cxx.o'.  Stop.
make[2]: *** [source/blender/compositor/CMakeFiles/bf_compositor.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [all] Error 2

Latest cmake is from brew.

Any ideas?

1 Like

I’m not seeing any build error on macOS with latest main. Maybe was a temporary issue?

If not a full build log would help.

Exactly the same problem here!

make[3]: *** No rule to make target `source/blender/compositor/CMakeFiles/bf_compositor.dir/cmake_pch_arm64.hxx.pch', needed by `source/blender/compositor/CMakeFiles/bf_compositor.dir/Unity/unity_24_cxx.cxx.o'. Stop.
make[2]: *** [source/blender/compositor/CMakeFiles/bf_compositor.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [all] Error 2

Still getting it. Brew did update my cmake recently so maybe that’s it. Anyway, here’s a log of a ‘make full’ run…

make_full.txt (377.6 KB)

can you try with a fresh build folder? (remove the /Users/chuckocheret/git/blender/build_darwin_full folder)

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

It seems good to have a patch like that for now.

If a developer wants to make a bug report and maybe even a reproduction case (not sure if they require one), that would be great.

CC @jacqueslucke who originally added unity build support.

Current main is failing for me on Linux with

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

Cmake is 3.28.2

The issue is not fixed in main yet, right?

Reported a bug here: