Skip to content
Latchkey

g++ "fatal error: Killed signal terminated program cc1plus" in CI

When a compile exceeds available memory the kernel OOM killer kills cc1plus, and g++ reports "fatal error: Killed signal terminated program cc1plus". The fix is to reduce peak memory per compile.

What this error means

A heavy translation unit or high parallel job count makes the build die with the Killed cc1plus message, often only on smaller runners.

g++
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[2]: *** [CMakeFiles/app.dir/big.cpp.o] Error 1

Common causes

How to fix it

Lower the parallel job count

  1. Reduce the number of concurrent compiles so total memory fits the runner.
  2. Re-run the build and watch peak memory.
Terminal
# fewer parallel jobs lowers peak memory
cmake --build build --parallel 2

Constrain per-compile memory

For GCC, --param ggc-min-expand and -O1 reduce frontend memory; split very large generated files where possible.

g++
g++ -O1 --param ggc-min-expand=10 -c big.cpp

How to prevent it

  • Cap parallel jobs to fit runner memory, split oversized translation units, and reserve LTO for jobs on larger runners so cc1plus is never OOM-killed.

Frequently asked questions

What causes ""Killed signal terminated program cc1plus""?
A heavy translation unit or high parallel job count makes the build die with the Killed cc1plus message, often only on smaller runners.
How do I fix "Killed signal terminated program cc1plus"?
Lower the parallel job count

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card