make "No rule to make target" in CI
make needs a file to satisfy a dependency but that file does not exist and no rule tells make how to create it. The prerequisite was deleted, is in the wrong path, or a header/generated file is missing.
What this error means
make stops with "make: *** No rule to make target 'foo.h', needed by 'main.o'. Stop." naming a prerequisite it cannot produce or locate.
make
make: *** No rule to make target 'include/config.h', needed by 'main.o'. Stop.Common causes
A prerequisite file does not exist
A header or source listed as a dependency was deleted, renamed, or never checked out on the runner.
A generated file was not generated first
A file expected to be produced by an earlier step is missing because that step did not run in CI.
How to fix it
Restore or regenerate the prerequisite
- Confirm the named file exists at the path make expects.
- Restore a deleted file or run the generator step that produces it.
- For generated headers, run the generation target before the main build.
Terminal
make generate-config
makeFix the path in the Makefile
If the file moved, update its path or the VPATH so make can find the prerequisite.
Makefile
VPATH = include:srcHow to prevent it
- Check that all generated files are produced by an explicit target.
- Keep prerequisite paths in the Makefile in sync with the tree.
- Do clean builds so stale expectations do not persist.
Related guides
make "*** [target] Error 1" recipe failed in CIFix make "*** [target] Error 1" in CI - a recipe command exited non-zero. The number is the exit code; the re…
Ninja "missing and no known rule to make it" in CIFix Ninja "error: X, needed by Y, missing and no known rule to make it" in CI - a build input does not exist…
CMake "CMAKE_MAKE_PROGRAM is not set" in CIFix CMake "CMAKE_MAKE_PROGRAM is not set" in CI - CMake could not find the build tool for the chosen generato…