flex error building verilator under SLES
My system is using the following OS and tool versions:
OS="SUSE Linux Enterprise Server 11 SP4" bison (GNU Bison) 1.875 flex version 2.5.4 gcc (GCC) 4.7.2 Under this system I have compiler errors when trying to build verilator as follows: In file included from V3Lexer_pregen.yy.cpp:245:0, from ../V3ParseLex.cpp:37: /usr/include/FlexLexer.h:130:14: error: expected unqualified-id before numeric constant In file included from ../V3ParseLex.cpp:37:0: V3Lexer_pregen.yy.cpp: In member function ‘virtual int V3LexerBase::yylex()’: V3Lexer_pregen.yy.cpp:3361:10: error: ‘yy_current_buffer’ was not declared in this scope In file included from ../V3ParseLex.cpp:37:0: V3Lexer_pregen.yy.cpp:6799:8: error: ‘yy_current_buffer’ was not declared in this scope V3Lexer_pregen.yy.cpp:6822:23: error: ‘yy_current_buffer’ was not declared in this scope V3Lexer_pregen.yy.cpp: In constructor ‘V3LexerBase::V3LexerBase(std::istream*, std::ostream*)’: V3Lexer_pregen.yy.cpp:6939:2: error: ‘yy_current_buffer’ was not declared in this scope V3Lexer_pregen.yy.cpp: In destructor ‘virtual V3LexerBase::~V3LexerBase()’: V3Lexer_pregen.yy.cpp:6951:20: error: ‘yy_current_buffer’ was not declared in this scope V3Lexer_pregen.yy.cpp: In member function ‘virtual void V3LexerBase::switch_streams(std::istream*, std::ostream*)’:
Is the build only compatible with Redhat?
Thanks & Regards
#1 Updated by Wilson Snyder about 2 years ago
- Description updated (diff)
Sorry, this should just work. It's probably a bug in the "flex" package, which has been buggy in the past. The file with the error is generated. Please attach V3Lexer_pregen.yy.cpp, and maybe we can find a workaround short of upgrading flex. You also didn't indicate the Verilator version - I assume it is the latest?
#5 Updated by Moira Richmond about 2 years ago
In file incldued from ../V3ParseGrammar.cpp:25:0: verilog.cL In function 'int yyparse()': verilog.c:19828:3: error: expected primary-expression before '__attribute__' verilog.c:19828:3: error: expected ';' before '__attribute__' make2 *** [V3ParseGrammar.o] Error 1
Everytime I try to attach V3Lexer_pregen.yy.cpp I am getting 'Internal Sever Error'. Fault on my side or yours?
#6 Updated by Wilson Snyder about 2 years ago
It's only included from V3ParseGrammer, not an error in V3Parse grammar.
Not sure why it isn't posting; you could post as a comment the lines near the error (verilog.c line 19828 and /usr/include/FlexLexer.h line 130)
But no need as I googled the FlexLexer message and it's a known bug in flex 2.5.4 which they fixed in 2.5.4a. You'll need a newer flex. Sorry.
#7 Updated by Moira Richmond almost 2 years ago
Thanks Wilson, an upgrade to versions of flex and bison fixed the compilation problems.
Could you help me out with one last thing -
When I make and install verilator it all looks good, ~/bin and ~/share contain the executables and directories. However when I go to run this against RTL to generate a model via a render script the script is searching in /usr/local/share/. for the vlstd dir containing vpi_user.h instead of my ~/share/include/verilator/vlstd, even though I thought this should be specified when --prefix was used by the configure script. Is there a way to change the include path?
Also available in: Atom