gdb compile issue yyin and lexer_init

Viewed 266

I am trying to compile gdb 9.2 in Ubuntu 18.04, The following errors are printed.

make[2]: Entering directory '/home/ata/gdb-9.2/build/gdb'
  CXX    ada-exp.o
ada-exp.y: In function ‘int ada_parse(parser_state*)’:
ada-exp.y:736:15: error: ‘yyin’ was not declared in this scope
ada-exp.y:736:15: note: suggested alternative: ‘yylen’
ada-exp.y:736:3: error: ‘lexer_init’ was not declared in this scope
ada-exp.y:736:3: note: suggested alternative: ‘pex_init’
In file included from ada-exp.y:56:0:

gdb 10.1 compiled successfully before this.

I searched online but could not come up with a reason or solution.

What might be the issue ?

Edit1: I have gcc version 7.5.0

1 Answers

I also faced this issue and this is how I fixed it:
ada-exp.y includes file ada-lex.c which contains the definition for function lexer_init.
But if you don't have flex installed initially, then it may generate an empty ada-lex.c (from ada-lex.l). And even if you do make clean, it will not clean the generated ada-lex.c, i.e., it will remain empty upon next compile command as well.
So to fix this error, you can delete all such intermediate .c files (in your case, building with fresh .tar.gz) and do the make again.

Related