Skip to content

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

@acehreli

Description

@acehreli

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions