]> git.ipfire.org Git - thirdparty/unbound.git/commit
Makefile.in: fix occasional parallel build failures around bison rule (#1167)
authorSergei Trofimovich <slyich@gmail.com>
Mon, 4 Nov 2024 12:26:05 +0000 (12:26 +0000)
committerGitHub <noreply@github.com>
Mon, 4 Nov 2024 12:26:05 +0000 (13:26 +0100)
commit46cfbf313d812a6e50614a691e162b171dc91d7b
tree1d19ff67ceb72111669d5f2267633021a8b4264f
parent533c3b0514b482514309b5dba1a430942f58fab5
Makefile.in: fix occasional parallel build failures around bison rule (#1167)

Without the change `make -j16 --shuffle` occasinally fails to build as:

    $ make -j16 --shuffle
    ...
    bison -y -d -o util/configparser.c ./util/configparser.y
    ...
    /libtool --tag=CC --mode=compile gcc -I.  -I...-openssl-3.3.2-dev/include -I...-libevent-2.1.12-dev/include -I...-expat-2.6.3-dev/include -DSRCDIR=. -g -O2 -flto -fPIE -pthread  -o configparser.lo -c util/configparser.c
    ...
    util/configparser.c:755:3: error: expected ',' or '}' at end of input
  755 |   YYSYMBOL_server_low_rtt = 626,           /* server_low_rtt  */
      |   ^

The build failure happens due to this `Makefile.in` rule:

    util/configparser.c util/configparser.h:  $(srcdir)/util/configparser.y
        @-if test ! -d util; then $(INSTALL) -d util; fi
        $(YACC) -d -o util/configparser.c $(srcdir)/util/configparser.y

For GNU make that means that each of the targets will attempt the rule
execution when the file is missing: one for .c file and another for .h
file:

    https://www.gnu.org/software/make/manual/html_node/Multiple-Targets.html

The workaround is to only run $(YACC) for .c target and use .c as a
pre-requisite for an .h file.

Before the change the build fails about every 10-th run.
After the change no build failures after 100 successful builds.
Makefile.in