Unity build errors since 3.28.2
Like #25650 (closed) we encountered this with O3DE since CMake 3.28.2, including CMake 3.29.0-rc1 (so !9215 (merged) doesn't fix it) on both Windows and Linux:
ninja: error: 'External/Compression-10c56b98/Code/CMakeFiles/Compression.Private.Object.dir/debug/Source/CompressionModuleInterface.cpp.o', needed by 'bin/debug/libCompression.Editor.so', missing and no known rule to make it
or with the default generator on Linux:
make[2]: *** No rule to make target 'External/Compression-300528aa/Code/CMakeFiles/Compression.Private.Object.dir/Source/CompressionModuleInterface.cpp.o', needed by 'bin/profile/libCompression.Editor.Tests.so'. Stop.
A couple of cpp files are apparently expected to build on their own, although they also appear in unity build files:
% grep -r CompressionModuleInterface.cpp External/*
External/Compression-10c56b98/Code/CMakeFiles/Compression.Private.Object.dir/Unity/unity_0_cxx.cxx:#include "code/Gems/Compression/Code/Source/CompressionModuleInterface.cpp"
I'm sorry that I cannot provide a minimal example, but the error happens immediately when the build is started with Ninja (with Makefiles it compiles a considerable amount of files before the error appears) after the following setup commands (on Linux):
git clone "https://github.com/o3de/o3de.git" code
mkdir build
cd code
git lfs install
git lfs pull
python/get_python.sh
cd ../build
cmake ../code -G "Ninja Multi-Config" -DLY_UNITY_BUILD=ON
cmake --build .
Edited by Brad King