Skip to content
Latchkey

Make "recipe for target ... failed" in CI

This is the GNU Make 4.2-and-earlier phrasing of a recipe failure. Like "Error 1", it is the summary - the real diagnostic is the compiler or shell error printed above it.

What this error means

The log shows Makefile:42: recipe for target 'app' failed followed by make: *** [app] Error 1. Both lines describe the same event: a recipe command returned non-zero.

make output
cc1plus: error: unrecognized command-line option '-std=c++23'
Makefile:42: recipe for target 'app.o' failed
make: *** [app.o] Error 1

Common causes

A recipe command failed

A compile, link, or shell command in the target’s recipe exited non-zero. The "recipe for target failed" line is make announcing that, not the cause.

Tool or flag mismatch in the recipe

Often the underlying command used an unsupported flag (e.g. a too-new -std= for an old compiler) or a tool the image lacks, which is what actually failed.

How to fix it

Find the underlying command error

  1. Read the lines above "recipe for target failed" - that command is the failure.
  2. Reproduce that exact command in the shell to iterate.
  3. Fix the real issue (unsupported flag, missing tool, source error).

Match the toolchain to the flags

If the recipe uses a newer standard or flag than the image’s compiler supports, install a newer compiler or lower the standard.

Terminal
apt-get install -y g++-13
make CXX=g++-13

How to prevent it

  • Read the real diagnostic above the recipe-failed line.
  • Pin a compiler version that supports the standard your build requests.
  • Keep CI and local toolchains aligned to avoid flag-support surprises.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →