ack
ack copied to clipboard
Failed to compile in CentOS 7
ACK failed to compile in CentOS 7, following is a snippet of error messages:
/tmp/ack-build/obj/util/ncgg/cggparser/y.tab.h: In function ‘enterkeyw’:
/tmp/ack-build/obj/util/ncgg/cggparser/y.tab.h:161:66: error: ‘ADDR’ undeclared (first use in this function)
int yyparse ();
^
/tmp/ack-build/obj/util/ncgg/cggparser/y.tab.h:161:66: note: each undeclared identifier is reported only once for ea
ch function it appears in
/tmp/ack-build/obj/util/ncgg/cggparser/y.tab.h:162:71: error: ‘COERCIONS’ undeclared (first use in this function)
#endif
^
/tmp/ack-build/obj/util/ncgg/cggparser/y.tab.h:163:74: error: ‘INSTRUCTIONS’ undeclared (first use in this function)
#endif /* ! YYPARSE_PARAM */
^
/tmp/ack-build/obj/util/ncgg/cggparser/y.tab.h:164:65: error: ‘INT’ undeclared (first use in this function)
^
/tmp/ack-build/obj/util/ncgg/cggparser/y.tab.h:165:67: error: ‘MOVES’ undeclared (first use in this function)
#endif /* !YY_YY_TMP_ACK_BUILD_OBJ_UTIL_NCGG_CGGPARSER_Y_TAB_H_INCLUDED */
^
/tmp/ack-build/obj/util/ncgg/cggparser/y.tab.h:166:70: error: ‘PATTERNS’ undeclared (first use in this function)
...
It seems that it's caused by old version of Bison (2.7 in CentOS 7), which do not include macro definitions for those constants (only enum definition is included), but util/ncgg/cvtkeywords
relys on those macros to work properly.
Complied successfully after I change bison
to byacc
, I'll close this issue.
Bison 3.0.4 still uses enum, not macros, for the token names. I don't use bison with ack, but this is a parse.c from Ruby:
/* A Bison parser, made by GNU Bison 3.0.4. */
...
enum yytokentype
{
END_OF_INPUT = 0,
keyword_class = 258,
keyword_module = 259,
keyword_def = 260,
...
Either we should fix ncgg to work with bison, or we should document in the top-level README that yacc can't be bison.
I found that Bison 3.0.4 does make the token macros, if I run it in yacc mode (bison -y). So ncgg works with bison -y.
Are there any non-Bison yaccs still around? Could we just switch to bison -y instead?
The other two flavors are Berkeley yacc and System V yacc. I am using OpenBSD's Berkeley yacc. I haven't tried System V yacc; it is part of systems like Solaris and Illumos, or in the Heirloom tools.
I don't see any reason to switch to bison -y.
I built the current github tree on RHEL 7 with no problem.
Visit http://oberon07/dee/ and click on RPMs for an RPM you can install.