https://sourceware.org/bugzilla/show_bug.cgi?id=22941
Bug ID: 22941 Summary: binutils build fails if intl/parser.y is newer than intl/parser.c Product: binutils Version: 2.31 (HEAD) Status: UNCONFIRMED Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: rprichard at google dot com Target Milestone: --- binutils has the same non-deterministic build problem that was reported in https://sourceware.org/bugzilla/show_bug.cgi?id=22432. (Aside: various other projects appear to have the same pair of files, e.g. gdb, gcc, e2fsprogs, ...) When I build binutils for Linux, it uses gettext from libc, but when I cross-compile for Windows, it instead used its bundled libintl. If I check out binutils source on a normal Linux desktop, the intl/plural.c and intl/plural.y typically have equal mtimes and ctimes, so the build system uses the intl/plural.c file (generated by Bison 1.35) and the build succeeds. If I instead use a WSL (Windows-Subsystem-for-Linux) environment, the intl/plural.y is typically newer than intl/plural.c (slower filesystem?), and the build system regenerates plural.c (using e.g. Bison 3.0.4). With the regenerated file, the build fails. Build errors: bison -y --name-prefix=__gettext --output plural.c ../../intl/plural.y ../../intl/plural.y:46.1-12: warning: deprecated directive, use ‘%pure-parser’ [-Wdeprecated] %pure_parser ^^^^^^^^^^^^ rm -f plural.h x86_64-w64-mingw32-gcc -c -g -O2 -D__USE_MINGW_ACCESS -DHAVE_CONFIG_H -I. -I../../intl plural.c In file included from ../../intl/plural.y:35:0: ../../intl/plural-exp.h:102:23: error: conflicting types for ‘libintl_gettextparse’ # define PLURAL_PARSE libintl_gettextparse ^ ../../intl/plural.y:40:25: note: in expansion of macro ‘PLURAL_PARSE’ # define __gettextparse PLURAL_PARSE ^~~~~~~~~~~~ plural.c:184:5: note: in expansion of macro ‘__gettextparse’ int __gettextparse (void); ^~~~~~~~~~~~~~ ../../intl/plural-exp.h:102:23: note: previous declaration of ‘libintl_gettextparse’ was here # define PLURAL_PARSE libintl_gettextparse ^ ../../intl/plural-exp.h:114:12: note: in expansion of macro ‘PLURAL_PARSE’ extern int PLURAL_PARSE PARAMS ((void *arg)); ^~~~~~~~~~~~ ../../intl/plural-exp.h:102:23: error: conflicting types for ‘libintl_gettextparse’ # define PLURAL_PARSE libintl_gettextparse ^ ../../intl/plural.y:40:25: note: in expansion of macro ‘PLURAL_PARSE’ # define __gettextparse PLURAL_PARSE ^~~~~~~~~~~~ plural.c:63:25: note: in expansion of macro ‘__gettextparse’ #define yyparse __gettextparse ^~~~~~~~~~~~~~ plural.c:1129:1: note: in expansion of macro ‘yyparse’ yyparse (void) ^~~~~~~ ../../intl/plural-exp.h:102:23: note: previous declaration of ‘libintl_gettextparse’ was here # define PLURAL_PARSE libintl_gettextparse ^ ../../intl/plural-exp.h:114:12: note: in expansion of macro ‘PLURAL_PARSE’ extern int PLURAL_PARSE PARAMS ((void *arg)); ^~~~~~~~~~~~ plural.c: In function ‘libintl_gettextparse’: plural.c:64:25: error: too few arguments to function ‘__gettextlex’ #define yylex __gettextlex ^ plural.c:1298:16: note: in expansion of macro ‘yylex’ yychar = yylex (&yylval); ^~~~~ plural.c:64:25: note: declared here #define yylex __gettextlex ^ ../../intl/plural.y:69:12: note: in expansion of macro ‘yylex’ static int yylex PARAMS ((YYSTYPE *lval, const char **pexp)); ^~~~~ ../../intl/plural.y:178:29: error: ‘arg’ undeclared (first use in this function) ((struct parse_args *) arg)->res = $1; ^~~ ../../intl/plural.y:178:29: note: each undeclared identifier is reported only once for each function it appears in Makefile:133: recipe for target 'plural.o' failed make[2]: *** [plural.o] Error 1 make[2]: Leaving directory '/usr/local/google/home/rprichard/android/binutils-gdb/out/intl' Makefile:6574: recipe for target 'all-intl' failed make[1]: *** [all-intl] Error 2 make[1]: Leaving directory '/usr/local/google/home/rprichard/android/binutils-gdb/out' Makefile:856: recipe for target 'all' failed make: *** [all] Error 2 binutils already requires bison to build, so it seems sensible to fix this issue the same way that glibc was already fixed: rprichard@cashew:~/android/binutils-gdb$ for f in $(find . -name '*.y'); do echo -- $f; find . -name $(basename ${f%.y}.c); done -- ./gold/yyscript.y -- ./intl/plural.y ./intl/plural.c ./out/intl/plural.c -- ./ld/ldgram.y -- ./ld/deffilep.y -- ./gas/itbl-parse.y -- ./gas/config/rx-parse.y -- ./gas/config/bfin-parse.y -- ./gas/config/rl78-parse.y -- ./gas/config/m68k-parse.y -- ./gdb/c-exp.y -- ./gdb/ada-exp.y -- ./gdb/m2-exp.y -- ./gdb/p-exp.y -- ./gdb/cp-name-parser.y -- ./gdb/rust-exp.y -- ./gdb/f-exp.y -- ./gdb/go-exp.y -- ./gdb/d-exp.y -- ./binutils/nlmheader.y -- ./binutils/defparse.y -- ./binutils/mcparse.y -- ./binutils/sysinfo.y -- ./binutils/rcparse.y -- ./binutils/arparse.y Steps to cross-compile binutils: On a Debian system, install the mingw-w64 package. This provide a GCC toolchain with the triple x86_64-w64-mingw32 (e.g. x86_64-w64-mingw32-gcc) Run these commands: /path/to/configure --host=x86_64-w64-mingw32 make -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils