flex
flex copied to clipboard
Error building flex
After following the instructions for configuring to build flex I receive the following errors:
gcc -DHAVE_CONFIG_H -I. -DLOCALEDIR="/usr/local/share/locale" -g -O2 -MT flex-yylex.o -MD -MP -MF .deps/flex-yylex.Tpo -c -o flex-yylex.o test -f 'yylex.c' || echo './'
yylex.c
mv -f .deps/flex-yylex.Tpo .deps/flex-yylex.Po
/bin/bash ../build-aux/ylwrap scan.l lex.yy.c scan.c -- flex
"/home/collison/OpenSource/flex/src/scan.l", line 3: unrecognized '%' directive
"/home/collison/OpenSource/flex/src/scan.l", line 6: bad character: #
"/home/collison/OpenSource/flex/src/scan.l", line 6: unknown error processing section 1
"/home/collison/OpenSource/flex/src/scan.l", line 6: unknown error processing section 1
"/home/collison/OpenSource/flex/src/scan.l", line 6: bad character: "
"/home/collison/OpenSource/flex/src/scan.l", line 6: unknown error processing section 1
"/home/collison/OpenSource/flex/src/scan.l", line 6: bad character: .
"/home/collison/OpenSource/flex/src/scan.l", line 6: unknown error processing section 1
"/home/collison/OpenSource/flex/src/scan.l", line 6: bad character: "
"/home/collison/OpenSource/flex/src/scan.l", line 7: bad character: }
Any help would be appreciated.
Sorry it's taken so long to get you an answer on this. It looks like this bug was fixed in version 2.6.4 by 7f263e3. A note in the ChangeLog mentions it:
2017-01-09 luistung <[email protected]>
* src/scan.l: scanner: join symbol list. Removed a newline that caused a problem building the scanner in some
circumstances. Specifically: 'bad character' error when executing /bin/sh ../build-aux/ylwrap scan.l lex.yy.c scan.c -- flex
If you can't upgrade but you can rebuild flex, the fix is pretty simple. Just join the two red lines in the diff at the commit link.
Encountered the same problem. It is due to my flex is too old :
# /router/bin/flex --version /router/bin/flex version 2.5.4
Using a newer version of flex v2.6.1 is able to compile v2.6.4
Using a newer version of flex v2.6.1 is able to compile v2.6.4
What's actually causing this though? Why is some random system-installed flex
relevant to the compilation of this project?