bug#62791: BUILT_SOURCES not honoured in parallel build?
Patch attached. Looks just fine. Thanks Reuben. I installed it. Closing ... --all the best, karl.
bug#62791: BUILT_SOURCES not honoured in parallel build?
On Sat, 9 Dec 2023 at 15:16, Reuben Thomas wrote: > > If you're happy with that, I'll write a patch. > Patch attached. -- https://rrt.sc3d.org From 06f6765b7d10132d0dcefde1265b4d5f01df76b4 Mon Sep 17 00:00:00 2001 From: Reuben Thomas Date: Sat, 9 Dec 2023 15:20:44 +0200 Subject: [PATCH] doc: add advice to list Yacc/Lex generated sources in BUILT_SOURCES This fixes #62791: it seems to be necessary to list the generated C source file for a Yacc/Lex file, as well as the header file in BUILT_SOURCES. --- doc/automake.texi | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/automake.texi b/doc/automake.texi index e53a44332..77292288d 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -6329,7 +6329,8 @@ extensions @file{.l}, @file{.ll}, @file{.l++}, @file{.lxx}, and @file{.lpp} are recognized. You should never explicitly mention the intermediate (C or C++) file -in any @code{SOURCES} variable; only list the source file. +in any @code{SOURCES} variable (except @code{BUILT_SOURCES}, see below); +only list the source file. The intermediate files generated by @command{yacc} (or @command{lex}) will be included in any distribution that is made. That way the user @@ -6359,11 +6360,11 @@ What Automake cannot guess, though, is where this header will be used: it is up to you to ensure the header gets built before it is first used. Typically this is necessary in order for dependency tracking to work when the header is included by another file. The common solution -is listing the header file in @code{BUILT_SOURCES} (@pxref{Sources}) -as follows. +is listing the header file, and the corresponding C file, in +@code{BUILT_SOURCES} (@pxref{Sources}) as follows. @example -BUILT_SOURCES = parser.h +BUILT_SOURCES = parser.h parser.c AM_YFLAGS = -d bin_PROGRAMS = foo foo_SOURCES = @dots{} parser.y @dots{} -- 2.34.1
bug#62791: BUILT_SOURCES not honoured in parallel build?
On Sat, 9 Dec 2023 at 00:03, Karl Berry wrote: > The manual currently says: "You should never explicitly mention the > intermediate (C or C++) file in any `SOURCES' variable; only list > the source file." > > I don't know the code here, and this probably wasn't the question, but I > think the manual's statement about "any `SOURCES' variables" was simply > not meant to apply to BUILT_SOURCES (probably didn't think about it), > I did wonder that myself. but rather to the "normal" something_SOURCES variables. So my gut > reaction is to add "(except @code{BUILT_SOURCES}, see below)". > > Later, it talks about adding the header file to > "BUIILT_SOURCES". This seems at odds with what Mike said and I found > empirically. > > I suggest that we could just say to add both files, although if you want > to try to understand what's actually going on, more power to you :). > In terms of solving the problem, that would seem the safer option. If you're happy with that, I'll write a patch. -- https://rrt.sc3d.org
bug#62791: BUILT_SOURCES not honoured in parallel build?
The manual currently says: "You should never explicitly mention the intermediate (C or C++) file in any `SOURCES' variable; only list the source file." I don't know the code here, and this probably wasn't the question, but I think the manual's statement about "any `SOURCES' variables" was simply not meant to apply to BUILT_SOURCES (probably didn't think about it), but rather to the "normal" something_SOURCES variables. So my gut reaction is to add "(except @code{BUILT_SOURCES}, see below)". Later, it talks about adding the header file to "BUIILT_SOURCES". This seems at odds with what Mike said and I found empirically. I suggest that we could just say to add both files, although if you want to try to understand what's actually going on, more power to you :). Best, Karl
bug#62791: BUILT_SOURCES not honoured in parallel build?
On Wed, 6 Dec 2023 at 23:59, Karl Berry wrote: > Any chance that one of you could write a patch for the manual to explain > whatever needs to be explained (better)? --thanks, karl. > I'd happily do that if I could work out, or someone could explain, exactly what's going on here. The manual currently says: "You should never explicitly mention the intermediate (C or C++) file in any ‘SOURCES’ variable; only list the source file." Later, it talks about adding the header file to "BUIILT_SOURCES". This seems at odds with what Mike said and I found empirically. -- https://rrt.sc3d.org
bug#62791: BUILT_SOURCES not honoured in parallel build?
Any chance that one of you could write a patch for the manual to explain whatever needs to be explained (better)? --thanks, karl.
bug#62791: BUILT_SOURCES not honoured in parallel build?
On Sun, 3 Dec 2023 at 03:47, Mike Frysinger wrote: > > > > I think I've worked it out: I need to add the .c file that is generated > > from the .y file, not the .h file, to BUILT_SOURCES. Certainly, doing > that > > fixes the problem. > > we prob could add a .y/.l example to the manual. i think i tripped over > this > error myself in a project in the past. i think you want to list both > files. > Thanks for the tip; on a belt-and-braces basis, it seems it can't hurt anyway, so I've added the .h file back as well. -- https://rrt.sc3d.org
bug#62791: BUILT_SOURCES not honoured in parallel build?
On 12 Apr 2023 18:14, Reuben Thomas via Bug reports for Automake wrote: > On Wed, 12 Apr 2023 at 17:59, Reuben Thomas wrote: > > On Wed, 12 Apr 2023 at 16:17, Reuben Thomas wrote: > > > >> I am bootstrapping GNU a2ps git master[1] with automake 1.16.5. When I do > >> a parallel build (in my case, MAKEFLAGS=-j4), I get build failures > >> sometimes: > > > > In fact, I don't need to do a parallel build, just build serially from a > > fresh git checkout, to reproduce this problem. It seems that I must be > > doing something wrong, but I can't work out what! > > I think I've worked it out: I need to add the .c file that is generated > from the .y file, not the .h file, to BUILT_SOURCES. Certainly, doing that > fixes the problem. we prob could add a .y/.l example to the manual. i think i tripped over this error myself in a project in the past. i think you want to list both files. -mike signature.asc Description: PGP signature
bug#62791: BUILT_SOURCES not honoured in parallel build?
On Wed, 12 Apr 2023 at 17:59, Reuben Thomas wrote: > On Wed, 12 Apr 2023 at 16:17, Reuben Thomas wrote: > >> I am bootstrapping GNU a2ps git master[1] with automake 1.16.5. When I do >> a parallel build (in my case, MAKEFLAGS=-j4), I get build failures >> sometimes: >> > > In fact, I don't need to do a parallel build, just build serially from a > fresh git checkout, to reproduce this problem. It seems that I must be > doing something wrong, but I can't work out what! > I think I've worked it out: I need to add the .c file that is generated from the .y file, not the .h file, to BUILT_SOURCES. Certainly, doing that fixes the problem. -- https://rrt.sc3d.org
bug#62791: BUILT_SOURCES not honoured in parallel build?
On Wed, 12 Apr 2023 at 16:17, Reuben Thomas wrote: > I am bootstrapping GNU a2ps git master[1] with automake 1.16.5. When I do > a parallel build (in my case, MAKEFLAGS=-j4), I get build failures > sometimes: > In fact, I don't need to do a parallel build, just build serially from a fresh git checkout, to reproduce this problem. It seems that I must be doing something wrong, but I can't work out what! -- https://rrt.sc3d.org
bug#62791: BUILT_SOURCES not honoured in parallel build?
I am bootstrapping GNU a2ps git master[1] with automake 1.16.5. When I do a parallel build (in my case, MAKEFLAGS=-j4), I get build failures sometimes: $ make all make all-am make[1]: Entering directory '/home/rrt/.local/var/repo/a2ps/src' YACC parsessh.c CC libparse_a-lexssh.o /home/rrt/repo/a2ps/src/ylwrap1077905 lexssh.c:38:11: fatal error: parsessh.h: No such file or directory 38 | #include "parsessh.h" | ^~~~ compilation terminated. make[1]: *** [Makefile:1710: libparse_a-lexssh.o] Error 1 make[1]: *** Waiting for unfinished jobs parsessh.output is unchanged updating parsessh.h make[1]: Leaving directory '/home/rrt/.local/var/repo/a2ps/src' make: *** [Makefile:1514: all] Error 2 But parsessh.h is listed in BUILT_SOURCES, so it should be built before any other target. [1] git clone https://git.savannah.gnu.org/git/a2ps.git -- https://rrt.sc3d.org