sql_yacc.cc:15677:30: 错误:too few arguments to function ‘int MYSQLlex(void*, void*)’【解决办法】

【问题】

源码编译mysql-5.5.30时,出现错误:

[root@localhost mysql-server-mysql-5.5.30]# make 
[  0%] Built target INFO_BIN
[  0%] Built target INFO_SRC
[  0%] Built target abi_check
[  2%] Built target zlib
[  8%] Built target edit
[  8%] Built target mysqlservices
[ 14%] Built target strings
[ 29%] Built target mysys
[ 29%] Built target dbug
[ 29%] Built target comp_err
[ 29%] Built target GenError
[ 29%] Built target archive
[ 29%] Built target blackhole
[ 30%] Built target csv
[ 30%] Built target example
[ 30%] Built target federated
[ 33%] Built target heap
[ 34%] Built target hp_test1
[ 34%] Built target hp_test2
[ 47%] Built target innobase
[ 55%] Built target myisam
[ 55%] Built target myisam_ftdump
[ 55%] Built target myisamchk
[ 55%] Built target myisamlog
[ 55%] Built target myisampack
[ 59%] Built target myisammrg
[ 63%] Built target perfschema
[ 63%] Built target mytap
[ 63%] Built target pfs-t
[ 63%] Built target pfs_instr-oom-t
[ 63%] Built target pfs_instr-t
[ 64%] Built target pfs_instr_class-oom-t
[ 64%] Built target pfs_instr_class-t
[ 65%] Built target audit_null
[ 65%] Built target auth
[ 65%] Built target auth_socket
[ 65%] Built target auth_test_plugin
[ 65%] Built target qa_auth_client
[ 65%] Built target qa_auth_interface
[ 65%] Built target qa_auth_server
[ 65%] Built target daemon_example
[ 65%] Built target ftexample
[ 66%] Built target semisync_master
[ 66%] Built target semisync_slave
[ 67%] Built target vio
[ 68%] Built target regex
[ 68%] Built target thr_lock
[ 69%] Built target clientlib
[ 69%] Built target libmysql
[ 69%] Built target mysqlclient
[ 69%] Built target symlink_libmysqlclient_r.a
[ 69%] Built target symlink_libmysqlclient_r.so
[ 70%] Built target symlink_libmysqlclient_r.so.18
[ 70%] Built target symlink_libmysqlclient_r.so.18.0.0
[ 70%] Built target base64-t
[ 70%] Built target bitmap-t
[ 70%] Built target lf-t
[ 70%] Built target my_atomic-t
[ 70%] Built target my_malloc-t
[ 71%] Built target my_rdtsc-t
[ 71%] Built target my_vsnprintf-t
[ 72%] Built target innochecksum
[ 72%] Built target my_print_defaults
[ 72%] Built target mysql_waitpid
[ 72%] Built target perror
[ 72%] Built target replace
[ 72%] Built target resolve_stack_dump
[ 72%] Built target resolveip
[ 73%] Built target bug25714
[ 73%] Built target mysql_client_test
[ 74%] Built target mysql
[ 74%] Built target mysql_plugin
[ 74%] Built target comp_sql
[ 74%] Built target GenFixPrivs
[ 74%] Built target mysql_upgrade
[ 74%] Built target mysqladmin
[ 75%] Built target mysqlbinlog
[ 75%] Built target mysqlcheck
[ 76%] Built target mysqldump
[ 76%] Built target mysqlimport
[ 76%] Built target mysqlshow
[ 77%] Built target mysqlslap
[ 77%] Built target mysqltest
[ 78%] Built target gen_lex_hash
[ 78%] Built target mysql_tzinfo_to_sql
[ 78%] Built target GenServerSource
[ 78%] Built target partition
[ 78%] Building CXX object sql/CMakeFiles/sql.dir/sql_yacc.cc.o
/opt/rh/mysql-server-mysql-5.5.30/sql/sql_yacc.cc: 在函数‘int MYSQLparse()’中:
/opt/rh/mysql-server-mysql-5.5.30/sql/sql_yacc.cc:15677:30: 错误:too few arguments to function ‘int MYSQLlex(void*, void*)’
       yychar = yylex (&yylval);
                              ^
/opt/rh/mysql-server-mysql-5.5.30/sql/sql_yacc.cc:64:25: 附注:在此声明
 #define yylex           MYSQLlex
                         ^
/opt/rh/mysql-server-mysql-5.5.30/sql/sql_yacc.yy:72:5: 附注:in expansion of macro ‘yylex’
 int yylex(void *yylval, void *yythd);
     ^
/opt/rh/mysql-server-mysql-5.5.30/sql/sql_yacc.yy:31:23: 错误:‘yythd’在此作用域中尚未声明
 #define YYTHD ((THD *)yythd)
                       ^
/opt/rh/mysql-server-mysql-5.5.30/sql/sql_yacc.yy:1658:23: 附注:in expansion of macro ‘YYTHD’
             THD *thd= YYTHD;
                       ^
/opt/rh/mysql-server-mysql-5.5.30/sql/sql_yacc.yy:31:23: 错误:‘yythd’在此作用域中尚未声明
 #define YYTHD ((THD *)yythd)
                       ^
/opt/rh/mysql-server-mysql-5.5.30/sql/sql_yacc.yy:32:18: 附注:in expansion of macro ‘YYTHD’
 #define YYLIP (& YYTHD->m_parser_state->m_lip)
                  ^
/opt/rh/mysql-server-mysql-5.5.30/sql/sql_yacc.yy:1670:37: 附注:in expansion of macro ‘YYLIP’
             Lex_input_stream *lip = YYLIP;
                                     ^
/opt/rh/mysql-server-mysql-5.5.30/sql/sql_yacc.yy:31:23: 错误:‘yythd’在此作用域中尚未声明
 #define YYTHD ((THD *)yythd)
                       ^
/opt/rh/mysql-server-mysql-5.5.30/sql/sql_yacc.yy:32:18: 附注:in expansion of macro ‘YYTHD’
 #define YYLIP (& YYTHD->m_parser_state->m_lip)
                  ^
/opt/rh/mysql-server-mysql-5.5.30/sql/sql_yacc.yy:1696:13: 附注:in expansion of macro ‘YYLIP’
             YYLIP->found_semicolon= NULL;
             ^
/opt/rh/mysql-server-mysql-5.5.30/sql/sql_yacc.yy:31:23: 错误:‘yythd’在此作用域中尚未声明
 #define YYTHD ((THD *)yythd)
                       ^
/opt/rh/mysql-server-mysql-5.5.30/sql/sql_yacc.yy:1768:23: 附注:in expansion of macro ‘YYTHD’
             THD *thd= YYTHD;
                       ^
/opt/rh/mysql-server-mysql-5.5.30/sql/sql_yacc.yy:31:23: 错误:‘yythd’在此作用域中尚未声明
 #define YYTHD ((THD *)yythd)
                       ^
/opt/rh/mysql-server-mysql-5.5.30/sql/sql_yacc.yy:1783:23: 附注:in expansion of macro ‘YYTHD’
             THD *thd= YYTHD;
                       ^
/opt/rh/mysql-server-mysql-5.5.30/sql/sql_yacc.yy:31:23: 错误:‘yythd’在此作用域中尚未声明
 #define YYTHD ((THD *)yythd)
                       ^
/opt/rh/mysql-server-mysql-5.5.30/sql/sql_yacc.yy:1793:23: 附注:in expansion of macro ‘YYTHD’
             THD *thd= YYTHD;
……

【解决办法】

根本原因是与系统中的bison版本不兼容,需要安装低于3.0的版本。

查看系统版本:

rpm -qa |grep bison

下载:

wget https://ftp.gnu.org/gnu/bison/bison-2.7.tar.gz --no-check-certificate

安装bison:

tar zxvf bison-2.7.tar.gz
cd bison-2.7
./configure
make && make install

安装bison后重新编译mysql即可。

猜你喜欢

转载自blog.csdn.net/whj99154562/article/details/128467575