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.
Your discussion
This browser holds the management token for this post.
Save management token
Keep this private. Anyone with the token can resolve or delete this discussion.
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.