Bison 3.5.91 with older Flex

Bruno Haible <[email protected]>
Newsgroups gmane.comp.parsers.bison.bugs
Message-ID <3046050.8Jp0CSfd66@omega>
When a flex version < 2.6.4 is in $PATH, bison fails to build.

More precisely, the configuration fails:
...
checking for flex... flex
checking whether lex is flex... yes
checking lex output file root... lex.yy
checking lex library... -lfl
checking whether yytext is a pointer... yes
...
config.status: executing tests/atconfig commands
  LEX      examples/c/reccalc/scan.stamp
flex: unknown flag '-'.  For usage, try
        flex --help
gmake: *** [Makefile:9998: examples/c/reccalc/scan.stamp] Error 1
  LEX      examples/c/reccalc/scan.stamp
flex: unknown flag '-'.  For usage, try
        flex --help
gmake: *** [Makefile:9998: examples/c/reccalc/scan.stamp] Error 1
$ flex --version
flex version 2.5.4
$ grep -i flex config.status 
S["FLEX_CXX_WORKS_FALSE"]="#"
S["FLEX_CXX_WORKS_TRUE"]=""
S["FLEX_WORKS_FALSE"]="#"
S["FLEX_WORKS_TRUE"]=""
S["LEX_IS_FLEX"]="true"
S["LEX"]="flex"
S["FLEX_SCANNER_CXXFLAGS"]=""

I don't know what the flex command is that the config.status attempts to
execute (because you chose to hide it). Most probably it contains options
that flex 2.5.4 does not understand.

$ flex --help
flex [-bcdfhilnpstvwBFILTV78+? -C[aefFmr] -ooutput -Pprefix -Sskeleton]
        [--help --version] [file ...]
        -b  generate backing-up information to lex.backup
        -c  do-nothing POSIX option
        -d  turn on debug mode in generated scanner
        -f  generate fast, large scanner
        -h  produce this help message
        -i  generate case-insensitive scanner
        -l  maximal compatibility with original lex
        -n  do-nothing POSIX option
        -p  generate performance report to stderr
        -s  suppress default rule to ECHO unmatched text
        -t  write generated scanner on stdout instead of lex.yy.c
        -v  write summary of scanner statistics to f
        -w  do not generate warnings
        -B  generate batch scanner (opposite of -I)
        -F  use alternative fast scanner representation
        -I  generate interactive scanner (opposite of -B)
        -L  suppress #line directives in scanner
        -T  flex should run in trace mode
        -V  report flex version
        -7  generate 7-bit scanner
        -8  generate 8-bit scanner
        -+  generate C++ scanner class
        -?  produce this help message
        -C  specify degree of table compression (default is -Cem):
                -Ca  trade off larger tables for better memory alignment
                -Ce  construct equivalence classes
                -Cf  do not compress scanner tables; use -f representation
                -CF  do not compress scanner tables; use -F representation
                -Cm  construct meta-equivalence classes
                -Cr  use read() instead of stdio for scanner input
        -o  specify output filename
        -P  specify scanner prefix other than "yy"
        -S  specify skeleton file
        --help     produce this help message
        --version  report flex version

$ cd examples/c/reccalc/

$ grep -i flex Makefile local.mk 
Makefile:FLEX = flex
Makefile:       $(FLEX) $(FLEXFLAGS) -o$*.c --header-file=$*.h $<
local.mk:if FLEX_WORKS
local.mk:endif FLEX_WORKS

Apparently the --header-file option is not supported.

Indeed: https://github.com/westes/flex/blob/master/NEWS
shows that the option --header was introduced in version 2.5.6.
And https://github.com/westes/flex/commit/56a530abf7e16ce35ea36748ff2e86f2f0022bc2
shows that the option --header-file was introduced in version 2.6.4.

Bruno
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.