dmoulding / boilermake

A reusable, but flexible, boilerplate Makefile.
GNU General Public License v3.0
192 stars 28 forks source link

'mkdir -p' commands used for various rules may race and fail in surprising ways #6

Open acehreli opened 11 years ago

acehreli commented 11 years ago

The following is a compilation output that I have seen today (I modified the paths manually):


g++ -o /foo/bar/car/zar.o [...] [...] compilation terminated. Assembler messages: Fatal error: can't create /foo/bar/car/zar.o: No such file or directory [...] make: * [/foo/bar/car/zar.o] Error 2 make: * Waiting for unfinished jobs....

The bug is not reproducible, so it is likely a hardware or OS problem.

The surprising thing is that the directory /foo/bar/car does exist, the disk is not full, and the file can be created manually in there.

I think the issue is the same as the one that is discussed here:

http://stackoverflow.com/questions/1894427/makefile-with-directory-tree-creation-suitable-for-parallel-j-build

Wow! I have just realized that Dan Moulding has been a contributor to that thread. :)

Anyway... I think the correct solution is to make those directories dependencies of the targets, instead of having multiple 'mkdir -p' commands of multiple targets race with each other.

acehreli commented 11 years ago

I don't know why the message "The bug is not reproducible, so it is likely a hardware or OS problem." is printed so large at least on my screen. It is part of the output; I think it is printed by g++.