Bug #71250 Bison 3 breaks mysql build
Submitted: 30 Dec 2013 15:23 Modified: 27 Mar 2014 20:55
Reporter: Raghavendra Prabhu Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.5, 5.6 OS:Linux
Assigned to: CPU Architecture:Any
Tags: bison, MySQL, parser, yacc

[30 Dec 2013 15:23] Raghavendra Prabhu
Description:
Tested with latest mysql 5.5 tree.

Fails as:

mysql-5.5/sql/sql_yacc.yy:31:23: error: ‘yythd’ was not declared in this scope
 #define YYTHD ((THD *)yythd)
                       ^
mysql-5.5/sql/sql_yacc.yy:38:14: note: in expansion of macro ‘YYTHD’
 #define Lex (YYTHD->lex)
              ^
mysql-5.5/sql/sql_yacc.yy:2217:13: note: in expansion of macro ‘Lex’
             Lex->sql_command= SQLCOM_CREATE_EVENT;
             ^
mysql-5.5/sql/sql_yacc.yy:31:23: error: ‘yythd’ was not declared in this scope
 #define YYTHD ((THD *)yythd)
                       ^
mysql-5.5/sql/sql_yacc.yy:38:14: note: in expansion of macro ‘YYTHD’
 #define Lex (YYTHD->lex)
              ^
mysql-5.5/sql/sql_yacc.yy:2224:13: note: in expansion of macro ‘Lex’
             Lex->event_parse_data->item_expression= $2;
             ^
mysql-5.5/sql/sql_yacc.yy:31:23: error: ‘yythd’ was not declared in this scope
 #define YYTHD ((THD *)yythd)
                       ^
mysql-5.5/sql/sql_yacc.yy:38:14: note: in expansion of macro ‘YYTHD’
 #define Lex (YYTHD->lex)
              ^
mysql-5.5/sql/sql_yacc.yy:2231:13: note: in expansion of macro ‘Lex’
             Lex->event_parse_data->item_execute_at= $2;
             ^
mysql-5.5/sql/sql_yacc.yy:31:23: error: ‘yythd’ was not declared in this scope
 #define YYTHD ((THD *)yythd)
                       ^
mysql-5.5/sql/sql_yacc.yy:38:14: note: in expansion of macro ‘YYTHD’
 #define Lex (YYTHD->lex)
              ^
mysql-5.5/sql/sql_yacc.yy:2239:13: note: in expansion of macro ‘Lex’
             Lex->event_parse_data->status= Event_parse_data::ENABLED;
             ^
mysql-5.5/sql/sql_yacc.yy:31:23: error: ‘yythd’ was not declared in this scope
 #define YYTHD ((THD *)yythd)
                       ^
mysql-5.5/sql/sql_yacc.yy:38:14: note: in expansion of macro ‘YYTHD’
 #define Lex (YYTHD->lex)
              ^

Also, haven't tested with 5.6 but it may affect that too.

How to repeat:

cmake: (should trigger with other cmake too but this is what I 
used).

 cmake -DBUILD_CONFIG=mysql_release \
      -DCMAKE_BUILD_TYPE=Debug \
     -DCMAKE_INSTALL_PREFIX="/mysql" \
      -DSYSCONFDIR=/etc/mysql \
      -DMYSQL_DATADIR=/var/lib/mysql \
      -DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock \
      -DDEFAULT_CHARSET=utf8 \
      -DDEFAULT_COLLATION=utf8_general_ci \
      -DENABLED_LOCAL_INFILE=ON \
      -DINSTALL_INFODIR=share/mysql/docs \
      -DINSTALL_MANDIR=share/man \
      -DINSTALL_PLUGINDIR=lib/mysql/plugin \
      -DINSTALL_SCRIPTDIR=bin \
      -DINSTALL_INCLUDEDIR=include/mysql \
      -DINSTALL_DOCREADMEDIR=share/mysql \
      -DINSTALL_SUPPORTFILESDIR=share/mysql \
      -DINSTALL_MYSQLSHAREDIR=share/mysql \
      -DINSTALL_DOCDIR=share/mysql/docs \
      -DINSTALL_SHAREDIR=share/mysql \
      -DWITH_READLINE=OFF \
      -DWITH_LIBEDIT=OFF \
      -DWITH_VALGRIND=ON \
      -DFEATURE_SET=community \
      -DWITH_ZLIB=system \
      -DWITH_SSL=system \
      -DWITH_LIBWRAP=OFF \
      -DWITH_EXTRA_CHARSETS=complex \
      -DWITH_EMBEDDED_SERVER=OFF \
      -DWITH_INNOBASE_STORAGE_ENGINE=1 \
      -DWITH_PARTITION_STORAGE_ENGINE=1 \
      -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
      -DWITHOUT_ARCHIVE_STORAGE_ENGINE=1 \
      -DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1 \
      -DWITHOUT_FEDERATED_STORAGE_ENGINE=1  

make 

Suggested fix:
Workaround is to downgrade bison to 2.x

Fix is to fix the yacc code in mysql.
[30 Dec 2013 15:33] Raghavendra Prabhu
Affects mysql 5.6 too.
[31 Dec 2013 8:08] MySQL Verification Team
Hello Raghavendra,

Thank you for the bug report.
Verified as described.

Thanks,
Umesh
[31 Dec 2013 8:09] MySQL Verification Team
5.5.35 make log

Attachment: make_log.log (application/octet-stream, text), 558.96 KiB.

[31 Dec 2013 19:47] MySQL Verification Team
// Similar issue seen on 5.6.15
[15 Jan 2014 14:18] Mattias Jonsson
This affects current Debian testing/unstable.

Downgrading bison to 2.x is the workaround:
apt-get remove bison libbison-dev
apt-get install bison=1:2.5.dfsg-2.1 libbison-dev=1:2.5.dfsg-2.1
[27 Mar 2014 20:55] Paul DuBois
Noted in 5.7.5 changelog.

MySQL did not compile with Bison 3. A workaround is to downgrade to Bison 2.
[1 Aug 2014 16:23] Laurynas Biveinis
5.5 $ bzr log -r 4658
------------------------------------------------------------
revno: 4658
committer: Gleb Shchepa <gleb.shchepa@oracle.com>
branch nick: 18978946-5.5
timestamp: Mon 2014-06-23 19:59:15 +0400
message:
  Bug #18978946: BACKPORT TO 5.6: BUGFIX FOR 18017820 "BISON 3 BREAKS MYSQL BUILD"
  
  Backport of the fix:
  
  : Bug 18017820: BISON 3 BREAKS MYSQL BUILD
  : ========================================    
  : 
  : The source of the reported problem is a removal of a few deprecated
  : things from Bison 3.x: 
  : * YYPARSE_PARAM macro (use the %parse-param bison directive instead),
  : * YYLEX_PARAM macro (use %lex-param instead),
  : 
  : The fix removes obsolete macro calls and introduces use of
  : %parse-param and %lex-param directives.