public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Unset M4 environment variable for flex
@ 2013-01-18 13:00 Michael Haubenwallner
  0 siblings, 0 replies; only message in thread
From: Michael Haubenwallner @ 2013-01-18 13:00 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 1841 bytes --]

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.

[-- Attachment #2: flex-without-m4-env.patch --]
[-- Type: text/x-patch, Size: 534 bytes --]

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 $@; \

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-01-18 13:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-18 13:00 [PATCH] Unset M4 environment variable for flex Michael Haubenwallner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).