This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Unset M4 environment variable for flex
- From: Michael Haubenwallner <michael dot haubenwallner at salomon dot at>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 18 Jan 2013 14:00:24 +0100
- Subject: [PATCH] Unset M4 environment variable for flex
Hi,
not sure if that is intentional though, but gcc-4.8-20130113 snapshot does /not/ ship with gcc/gengtype-lex.c.
I've expected the FLEX=/path/to/flex environment variable to be enough, as it is not in PATH here on AIX.
But alas, this creates an empty gcc/gengtype-lex.c, resulting in:
ld: 0711-317 ERROR: Undefined symbol: lexer_line
ld: 0711-317 ERROR: Undefined symbol: .yylex(char const**)
ld: 0711-317 ERROR: Undefined symbol: .yybegin(char const*)
ld: 0711-317 ERROR: Undefined symbol: lexer_toplevel_done
ld: 0711-317 ERROR: Undefined symbol: .yyend()
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: ld returned 8 exit status
gmake[3]: *** [build/gengtype] Error 1
Searching upwards in the build log (single job), there is:
/path/to/flex -ogengtype-lex.c /path/to/src/gcc-4.8-20130113/gcc/gengtype-lex.l && { \
echo '#include "bconfig.h"' > gengtype-lex.c.tmp; \
cat gengtype-lex.c >> gengtype-lex.c.tmp; \
mv gengtype-lex.c.tmp gengtype-lex.c; \
}
m4: illegal option -- P
Usage: m4 [-els] [-B Number] [-D Name[=Value]]... [-H Number]
[-I Directory] [-S Number] [-T Number] [-U Name]... [File...]
gmake[3]: [gengtype-lex.c] Error 141 (ignored)
Actually, flex does prefer the M4 environment variable over its builtin path to run m4 from.
But configure does set M4=m4, found via PATH as /usr/bin/m4, which obviously is not GNU m4.
In my opinion, it is more robust to unset M4 environment variable before running $(FLEX)
than expecting users to also set M4 when gcc actually tells missing flex only.
Thank you!
/haubi/
2013-01-18 Michael Haubenwallner <michael.haubenwallner@salomon.at>
Flex gives M4 environment variable precedence over builtin path to m4.
* gcc/Makefile.in: Unset M4 environment variable before running flex.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 55b4d2d..66b4e96 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3990,7 +3990,7 @@ $(genprog:%=build/gen%$(build_exeext)): build/gen%$(build_exeext): build/gen%.o
# bconfig.h because AIX requires _LARGE_FILES to be defined before
# any system header is included.
gengtype-lex.c : gengtype-lex.l
- -$(FLEX) $(FLEXFLAGS) -o$@ $< && { \
+ -unset M4; $(FLEX) $(FLEXFLAGS) -o$@ $< && { \
echo '#include "bconfig.h"' > $@.tmp; \
cat $@ >> $@.tmp; \
mv $@.tmp $@; \