On Sat, Dec 13, 2025 at 11:01:24AM +0100, Patrice Dumas wrote:
> Hello,
> 
> When I do
> make maintainer-clean
> ./configure
> make -j8
> 
> I get the following errors:
> 
> mv: cannot stat 'tmp.element_types': No such file or directory
> make[4]: *** [Makefile:5859: stamp.element_types] Error 1
> make[4]: Leaving directory '/home/dumas/src/texinfo/tta/C'
> make[3]: *** [Makefile:5863: main/element_types.h] Error 2
> 
> and same for tmp.css_data/stamp.css_data
> 
> Removing the @ from Makefile.am and looking a bit more up in the make
> output, I see that the rules are run twice, which leads to a race
> condition, with tmp.element_types already being moved by the first run
> of the rule:
> 
> make[4]: Entering directory '/home/dumas/src/texinfo/tta/C'
> rm -f tmp.element_types
> make[4]: Entering directory '/home/dumas/src/texinfo/tta/C'
> touch tmp.element_types
> make[4]: Entering directory '/home/dumas/src/texinfo/tta/C'
> rm -f tmp.element_types
> /bin/bash '/home/dumas/src/texinfo/tta/build-aux/missing' gawk -v 
> srcdir=./main -f ./main/element_types.awk \
>      ./main/element_types.txt
> touch tmp.element_types
> /bin/bash '/home/dumas/src/texinfo/tta/build-aux/missing' gawk -v 
> srcdir=./main -f ./main/element_types.awk \
>      ./main/element_types.txt
> mv -f tmp.element_types stamp.element_types
> make[4]: Leaving directory '/home/dumas/src/texinfo/tta/C'
> make[4]: Leaving directory '/home/dumas/src/texinfo/tta/C'
> mv -f tmp.element_types stamp.element_types

I replicated this problem easily with the same commands as you.
The section of the automake manual on this is horrendous (Info node
"(automake)Multiple Outputs").

>From the automake manual:

       Admittedly, such a weird situation does not arise during ordinary
    builds.  It occurs only when the build tree is mutilated.  Here ‘data.c’
    and ‘data.h’ have been explicitly removed without also removing
    ‘data.stamp’ and the other output files.  ‘make clean; make’ will always
    recover from these situations even with parallel makes, so you may
    decide that the recover rule is solely to help non-parallel make users
    and leave things as-is.  Fixing this requires some locking mechanism to
    ensure only one instance of the recover rule rebuilds ‘data.stamp’.  One
    could imagine something along the following lines.

(The manual then goes on to give two more complicated sets of Makefile
rules.  Where I get annoyed by this manual is that it doesn't give a
clear, recommended solution for dealing with this issue.  "One could
imagine something along the following lines."  So has anybody actually
used code like this successfully, or is the manual just carelessly throwing
out advice for the users to figure out the details?)

After running "make maintainer-clean", I checked that tta/C/stamp.element_types
still existed (as did other stamp files).  This appears to be the situation
described in the automake manual.

Adding the stamp files to MAINTAINERCLEAN files appears to fix the problem.

If problems continue, then it is possible that we just need to accept that
running "make maintainer-clean" may not always run smoothly, as this is not
a command that users would need to run.


Reply via email to