[CMake] Parallel builds do not work correctly when using "cmake -E copy" to copy files

Alan W. Irwin irwin at beluga.phys.uvic.ca
Thu Dec 13 15:24:16 EST 2007


On 2007-12-12 17:10-0800 Alan W. Irwin wrote:

> A set of custom rules to copy files from the source tree to the build tree
> is screwing up for parallel builds on Debian testing with cmake 2.4.7.

> Here is part of the "make -j 2" output:
>
> make -f examples/tcl/CMakeFiles/tclIndex_examples_tcl.dir/build.make 
> examples/tcl/CMakeFiles/tclIndex_examples_tcl.dir/build
[...]
> make[2]: *** [examples/tcl/x05] Error 1
> make[2]: Leaving directory `/home/software/plplot_cvs/HEAD/build_dir'
> /usr/bin/cmake -E cmake_progress_report 
> /home/software/plplot_cvs/HEAD/build_dir/CMakeFiles make[1]: *** 
> [examples/tcl/CMakeFiles/tclIndex_examples_tcl.dir/all] Error 2
> make[1]: *** Waiting for unfinished jobs....

Note, the above make command is generated recursively from the overall
"make -j 2" command.  I have no idea how the -j option was propagated in
that case, but I assume it was via some Makefile variable.

Now here is the really strange part.  If I directly run

make -f examples/tcl/CMakeFiles/tclIndex_examples_tcl.dir/build.make \
examples/tcl/CMakeFiles/tclIndex_examples_tcl.dir/clean
make -j 2 -f examples/tcl/CMakeFiles/tclIndex_examples_tcl.dir/build.make \
examples/tcl/CMakeFiles/tclIndex_examples_tcl.dir/build

from the command line there are no extra copying operations and no errors.
Also, all other attempts to reproduce this bug from a hand-crafted Makefile
have failed.
However, the double copy is reliably reproduced in the build tree by

make clean
make -j 2

and intermittently that above sequence produces other "*** Waiting for
unfinished jobs..." errors as well, but those are more complicated than
the simple double copy errors I have documented so I won't go into details.

In sum, so far it appears I need CMake-generated Makefiles that are
recursively run with "make -j 2" in order to see parallel build errors.
Thus, my working hypothesis is these bad parallel build results are due to
some CMake error (a Makefile variable that is set or propagated
incorrectly?) in the way it does make recursion.

My obvious next step is to try and make a simple CMake example that reliably
reproduces the bug, but this is such an important bug (at least for those
with access to multiprocessors who want to use parallel builds) that I
thought the above result was worth reporting immediately since it tends to
point the finger at something CMake is doing rather than some bug in GNU
make.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list