Hi,
we recently migrated our build system from CMake 3.6.3 to 3.20.2. We build on Windows with VS and on Linux with various cross compilers and mostly the migration went smoothly. However one of our Linux builds using gcc 4.9.4 is crashing with an internal compiler error since the migration. To make things worse it does that randomly roughly in 1 out of three runs. Always on the same source file (needless to say that it hasn’t changed )
When I compared the parameters passed to the compiler I only saw one difference when running CMake 3.20:
-MD -MT Tests/NAME_OF_THE_TARGET/CMakeFiles/NAME_OF_THE_TARGET.dir/NAME_OF_THE_SOURCE_FILE.cpp.o -MF CMakeFiles/NAME_OF_THE_TARGET.dir/NAME_OF_THE_SOURCE_FILE.cpp.o.d -o CMakeFiles/NAME_OF_THE_TARGET.dir/NAME_OF_THE_SOURCE_FILE.cpp.o
This is new with the latest CMake version and from the release notes it seems to be related to the following statement in version 3.20
Makefile Generators, for some toolchains, now use the compiler to extract implicit dependencies while compiling source files.
What I see then is this:
x86_64-unknown-linux-gnu-g++: internal compiler error: Killed (program cc1plus)
make[2]: Leaving directory '/tmp/BUILD_DIR'
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[2]: *** [Tests/NAME_OF_THE_TARGET/CMakeFiles/NAME_OF_THE_TARGET.dir/build.make:76: Tests/NAME_OF_THE_TARGET/CMakeFiles/NAME_OF_THE_TARGET.dir/NAME_OF_THE_SOURCE_FILE.cpp.o] Error 4
make[1]: *** [CMakeFiles/Makefile2:4833: Tests/NAME_OF_THE_TARGET/CMakeFiles/NAME_OF_THE_TARGET.dir/all] Error 2
What might be important is that we call ‘make’ with the ‘-j’ switch so multiple instances run in parallel. Our idea was that maybe the access to this dependecy file is somewhat not thread-safe but we might be completely wrong there.
Does that ring a bell anywhere?
Regards,
Stefan