Bug #77196 mysql 5.6.25 compiled error on gcc 4.1.2
Submitted: 30 May 2015 12:41 Modified: 14 Jul 2015 6:21
Reporter: Fangxin Flou (OCA) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.6.25 OS:Linux
Assigned to: CPU Architecture:Any
Tags: server

[30 May 2015 12:41] Fangxin Flou
Description:
/data/mysql-5.6.25-patched/sql/mysqld.cc: In function ‘int mysqld_main(int, char**)’:
/data/mysql-5.6.25-patched/sql/mysqld.cc:5693: error: expected primary-expression before ‘void’
/data/mysql-5.6.25-patched/sql/mysqld.cc:5693: error: expected `)' before ‘void’
/data/mysql-5.6.25-patched/sql/mysqld.cc:5693: error: expected `;' before ‘while’
make[2]: *** [sql/CMakeFiles/sql.dir/mysqld.cc.o] Error 1

#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
  /* engine specific hook, to be made generic */
  if (ndb_wait_setup_func && ndb_wait_setup_func(opt_ndb_wait_setup))
  {
    sql_print_warning("NDB : Tables not available after %lu seconds."
                      "  Consider increasing --ndb-wait-setup value",
                      opt_ndb_wait_setup);
  }
#endif

  (void)MYSQL_SET_STAGE(0 ,__FILE__, __LINE__);  --generated compilation error here

#if defined(_WIN32) || defined(HAVE_SMEM)
  handle_connections_methods();
#else
  handle_connections_sockets();
#endif /* _WIN32 || HAVE_SMEM */

How to repeat:
Compile source code on centos 5.3 (gcc 4.1.2)

Suggested fix:
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
  /* engine specific hook, to be made generic */
  if (ndb_wait_setup_func && ndb_wait_setup_func(opt_ndb_wait_setup))
  {
    sql_print_warning("NDB : Tables not available after %lu seconds."
                      "  Consider increasing --ndb-wait-setup value",
                      opt_ndb_wait_setup);
  }
#endif

  /* (void)MYSQL_SET_STAGE(0 ,__FILE__, __LINE__); */
  (void)MYSQL_SET_STAGE(0 ,__FILE__, __LINE__);

#if defined(_WIN32) || defined(HAVE_SMEM)
  handle_connections_methods();
#else
  handle_connections_sockets();
#endif /* _WIN32 || HAVE_SMEM */
[30 May 2015 12:41] Fangxin Flou
changed 

(void)MYSQL_SET_STAGE(0 ,__FILE__, __LINE__);

to

MYSQL_SET_STAGE(0 ,__FILE__, __LINE__);
[1 Jun 2015 14:26] MySQL Verification Team
Hello Fangxin Flou,

Thank you for the report.
I'm not seeing reported error on CentOS 5.3 with cmake version 2.6-patch 4/gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44). Could you please share exact cmake command used for this issue?

Thanks,
Umesh
[1 Jun 2015 23:35] Fangxin Flou
cmake . -DWITH_EMBEDDED_SERVER=0 \
        -DWITH_ARCHIVE_STORAGE_ENGINE=0 \
        -DWITH_BLACKHOLE_STORAGE_ENGINE=0 \
        -DWITH_EXAMPLE_STORAGE_ENGINE=0 \
        -DWITH_TOKUDB_STORAGE_ENGINE=1 \
        -DWITH_FEDERATED_STORAGE_ENGINE=0 \
        -DWITH_NDBCLUSTER_STORAGE_ENGINE=0 \
        -DENABLE_DTRACE=0 -DENABLED_PROFILING=1 \
        -DWITH_UNIT_TESTS=0 \
        -DENABLE_DEBUG_SYNC=0 -DENABLE_GCOV=0 -DWITH_SSL=bundled -DWITH_ZLIB=bundled \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX=/usr/local/mysql5.6 \
        -LH

[root@localhost data]# uname -a
Linux localhost.localdomain 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost data]# gcc --version
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[root@localhost proc]# cat version
Linux version 2.6.18-164.el5 (mockbuild@x86-003.build.bos.redhat.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)) #1 SMP Tue Aug 18 15:51:48 EDT 2009
[root@localhost proc]#
[1 Jun 2015 23:37] Fangxin Flou
[root@localhost proc]# cmake --version
cmake version 2.8.12.2
[2 Jun 2015 8:56] MySQL Verification Team
Thank you for the requested details.
I'm still not seeing the issue, may be you have patched source? Please take a look at the build log and see if there is anything missing which would help me trigger this build issue.
[2 Jun 2015 8:57] MySQL Verification Team
Build log..

Attachment: 77196.txt (text/plain), 146.01 KiB.

[10 Jun 2015 10:24] Fangxin Flou
I tried again on different machine, still get the same result.

I download the source from the download page, not from code repository.
[10 Jun 2015 10:35] Fangxin Flou
the build log

Attachment: build.log (application/octet-stream, text), 93.88 KiB.

[10 Jun 2015 10:37] Fangxin Flou
the error message

/data/mysql-5.6.25/sql/mysqld.cc: In function ‘int mysqld_main(int, char**)’:
/data/mysql-5.6.25/sql/mysqld.cc:5670: error: expected primary-expression before ‘void’
/data/mysql-5.6.25/sql/mysqld.cc:5670: error: expected `)' before ‘void’
/data/mysql-5.6.25/sql/mysqld.cc:5670: error: expected `;' before ‘while’
make[2]: *** [sql/CMakeFiles/sql.dir/mysqld.cc.o] Error 1
make[1]: *** [sql/CMakeFiles/sql.dir/all] Error 2
make: *** [all] Error 2

the fix is very simple, remove the "(void)" of the following line 

(void)MYSQL_SET_STAGE(0 ,__FILE__, __LINE__);
[10 Jun 2015 10:58] MySQL Verification Team
Thank you for the feedback.
Without P_S, seeing:

[ 99%] Building CXX object sql/CMakeFiles/sql.dir/mysqld.cc.o
In file included from /export/umesh/server/source/mysql-5.6.25/sql/sql_class.h:43:0,
                 from /export/umesh/server/source/mysql-5.6.25/sql/sql_acl.h:21,
                 from /export/umesh/server/source/mysql-5.6.25/sql/sql_parse.h:20,
                 from /export/umesh/server/source/mysql-5.6.25/sql/mysqld.cc:28:
/export/umesh/server/source/mysql-5.6.25/sql/mysqld.cc: In function ‘int mysqld_main(int, char**)’:
/export/umesh/server/source/mysql-5.6.25/include/mysql/psi/mysql_stage.h:49:5: error: expected primary-expression before ‘do’
     do {} while (0)
     ^
/export/umesh/server/source/mysql-5.6.25/sql/mysqld.cc:5670:9: note: in expansion of macro ‘MYSQL_SET_STAGE’
   (void)MYSQL_SET_STAGE(0 ,__FILE__, __LINE__);
         ^
/export/umesh/server/source/mysql-5.6.25/include/mysql/psi/mysql_stage.h:49:5: error: expected ‘;’ before ‘do’
     do {} while (0)
     ^
/export/umesh/server/source/mysql-5.6.25/sql/mysqld.cc:5670:9: note: in expansion of macro ‘MYSQL_SET_STAGE’
   (void)MYSQL_SET_STAGE(0 ,__FILE__, __LINE__);
         ^
make[2]: *** [sql/CMakeFiles/sql.dir/mysqld.cc.o] Error 1
make[1]: *** [sql/CMakeFiles/sql.dir/all] Error 2
make: *** [all] Error 2
[umshastr@hod03]/export/umesh/server/source/mysql-5.6.25:
[10 Jun 2015 10:59] MySQL Verification Team
test results

Attachment: 77196_withoutPS.txt (text/plain), 105.34 KiB.

[14 Jul 2015 6:21] Erlend Dahl
Duplicate of

Bug#77292 NON PFS builds compilation issue.

[12 Jun 13:08] Paul Dubois

Noted in 5.6.26, 5.7.8, 5.8.0 changelogs.

Compilation failed when building MySQL without the Performance
Schema.