Progrider

Programming discussion

Board index
Help · ✓ Resolved

make -j breaks, works fine in serial

Build has a generated header, version.h from a script, and main.c includes it. make works. make -j8 sometimes fails with version.h: No such file. I've got it listed under all: first, which I now suspect isn't doing what I thought.

2 replies

Answering myself. Order in a prerequisite list isn't a sequence under -j. main.o needs an actual dependency on it: main.o: version.h And -MMD -MP gets you the rest of the headers, but not on a first build, since the .d files don't exist yet. So generated headers need stating explicitly. Working.
Recursive make hides this a lot of the time and then fails for you on the CI machine with more cores. Glad you found it.

Discussion resolved

This discussion is resolved. Its creator can reopen it to accept more replies.