Bug #58699 cannot build with gcc dbg on solaris
Submitted: 3 Dec 2010 14:23 Modified: 6 Jan 2011 1:15
Reporter: Tor Didriksen Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.5+ OS:Solaris
Assigned to: Tor Didriksen CPU Architecture:Any

[3 Dec 2010 14:23] Tor Didriksen
Description:
With the current FLAGS settings including -Werror, the build is broken in several places:

mysys/charset.c:432: warning: missing braces around initializer
mysys/charset.c:432: warning: (near initialization for `charsets_initialized.__pthread_once_pad')
mysys/charset.c:433: warning: missing braces around initializer
mysys/charset.c:433: warning: (near initialization for `charsets_template.__pthread_once_pad')
================
mysys/ptr_cmp.c:53: warning: unused parameter 'size'
mysys/ptr_cmp.c:79: warning: 'ptr_compare' defined but not used
mysys/ptr_cmp.c:94: warning: 'ptr_compare_0' defined but not used
mysys/ptr_cmp.c:115: warning: 'ptr_compare_1' defined but not used
mysys/ptr_cmp.c:136: warning: 'ptr_compare_2' defined but not used
mysys/ptr_cmp.c:158: warning: 'ptr_compare_3' defined but not used
================
In file included from include/my_global.h:76,
                 from storage/perfschema/pfs_instr.cc:23:
include/my_config.h:467:1: "_FILE_OFFSET_BITS" redefined
In file included from /usr/include/iso/string_iso.h:30,
                 from /usr/include/string.h:18,
                 from storage/perfschema/pfs_instr.cc:21:
/usr/include/sys/feature_tests.h:188:1: this is the location of the previous definition
================
In file included from include/my_global.h:76,
                 from include/my_dir.h:19,
                 from include/mysql/psi/mysql_file.h:22,
                 from storage/csv/transparent_file.cc:21:
include/my_config.h:467:1: "_FILE_OFFSET_BITS" redefined
In file included from /usr/include/iso/string_iso.h:30,
                 from /usr/include/string.h:18,
                 from include/mysql/psi/mysql_file.h:20,
                 from storage/csv/transparent_file.cc:21:
================
In file included from include/my_global.h:76,
                 from sql/sql_class.h:26,
                 from sql/my_decimal.cc:20:
include/my_config.h:467:1: "_FILE_OFFSET_BITS" redefined
In file included from /usr/include/time.h:18,
                 from sql/my_decimal.cc:17:
/usr/include/sys/feature_tests.h:188:1: this is the location of the previous definition
================
sql/mysqld.cc: In function `int init_common_variables()':
sql/mysqld.cc:3257: warning: comparison between signed and unsigned integer expressions
================
sql/sql_show.cc: In function `bool show_status_array(THD*, const char*, SHOW_VAR*, enum_var_type, system_status_var*, const char*, TABLE*, bool, COND*)':
sql/sql_show.cc:2249: warning: cast from pointer to integer of different size
================
In file included from include/my_global.h:76,
                 from include/m_string.h:24,
                 from sql/sql_plugin.h:30,
                 from sql/partition_info.cc:24:
include/my_config.h:467:1: "_FILE_OFFSET_BITS" redefined
In file included from /usr/include/iso/stdlib_iso.h:30,
                 from /usr/include/stdlib.h:18,
                 from include/mysql/service_my_snprintf.h:75,
                 from include/mysql/services.h:21,
                 from include/mysql/plugin.h:51,
                 from sql/sql_plugin.h:27,
                 from sql/partition_info.cc:24:
/usr/include/sys/feature_tests.h:188:1: this is the location of the previous definition
================
In file included from include/my_global.h:76,
                 from sql/sql_class.h:26,
                 from sql/sql_audit.h:21,
                 from sql/sql_audit.cc:17:
include/my_config.h:467:1: "_FILE_OFFSET_BITS" redefined
In file included from /usr/include/iso/stdlib_iso.h:30,
                 from /usr/include/stdlib.h:18,
                 from include/mysql/service_my_snprintf.h:75,
                 from include/mysql/services.h:21,
                 from include/mysql/plugin.h:51,
                 from include/mysql/plugin_audit.h:23,
                 from sql/sql_audit.h:20,
                 from sql/sql_audit.cc:17:
/usr/include/sys/feature_tests.h:188:1: this is the location of the previous definition
================
sql/sys_vars.h: In member function `virtual void Sys_var_plugin::global_save_default(THD*, set_var*)':
sql/sys_vars.h:1194: warning: cast to pointer from integer of different size
sql/sys_vars.h: In member function `virtual void Sys_var_struct::global_save_default(THD*, set_var*)':
sql/sys_vars.h:1559: warning: cast to pointer from integer of different size
================

How to repeat:
cmake -DWITH_DEBUG=1
make

$uname -a
SunOS khepri21 5.10 Generic_141445-09 i86pc i386 i86pc

$gcc --version
gcc (GCC) 3.4.6
[13 Dec 2010 16:04] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/126679

3187 Tor Didriksen	2010-12-13
      Bug #58699 cannot build with gcc dbg on solaris
     @ include/my_pthread.h
        On solaris pthread_once_t contains an array, so we must wrap the initialization in {}
     @ include/mysql/psi/mysql_file.h
        Include my_global.h first, to get correct platform definitions.
     @ mysys/ptr_cmp.c
        Hide the unused static functions in #ifdef's on solaris.
     @ sql/my_decimal.cc
        Include my_global.h first, to get correct platform definitions.
     @ sql/mysqld.cc
        Fix signed/unsigned comparison warning.
     @ sql/sql_audit.h
        Include my_global.h first, to get correct platform definitions.
     @ sql/sql_plugin.h
        Include my_global.h first, to get correct platform definitions.
     @ sql/sql_show.cc
        Fix: warning: cast from pointer to integer of different size
     @ sql/sys_vars.h
        Use reinterpret_cast rather than c-style cast.
     @ storage/perfschema/pfs_instr.cc
        Include my_global.h first, to get correct platform definitions.
[15 Dec 2010 8:32] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/126888

3195 Tor Didriksen	2010-12-13
      Bug #58699 cannot build with gcc dbg on solaris
     @ include/my_pthread.h
        On solaris pthread_once_t contains an array, so we must wrap the initialization in {}
     @ include/mysql/psi/mysql_file.h
        Include my_global.h first, to get correct platform definitions.
     @ mysys/ptr_cmp.c
        Hide the unused static functions in #ifdef's on solaris.
     @ sql/my_decimal.cc
        Include my_global.h first, to get correct platform definitions.
     @ sql/mysqld.cc
        Fix signed/unsigned comparison warning.
     @ sql/sql_audit.h
        Include my_global.h first, to get correct platform definitions.
     @ sql/sql_plugin.h
        Include my_global.h first, to get correct platform definitions.
     @ sql/sql_show.cc
        Fix: warning: cast from pointer to integer of different size
     @ sql/sys_vars.h
        Use reinterpret_cast rather than c-style cast.
     @ storage/perfschema/pfs_instr.cc
        Include my_global.h first, to get correct platform definitions.
[20 Dec 2010 14:02] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/127312

3216 Tor Didriksen	2010-12-20
      Bug #58699 cannot build with gcc dbg on solaris
     @ cmake/os/SunOS.cmake
        Remove TARGET_OS_SOLARIS
     @ config.h.cmake
        Remove TARGET_OS_SOLARIS
        Add PTHREAD_ONCE_INITIALIZER
     @ configure.cmake
        Add function for testing whether we need { PTHREAD_ONCE_INIT } rather than PTHREAD_ONCE_INIT
     @ include/my_pthread.h
        Use PTHREAD_ONCE_INITIALIZER if set by cmake.
     @ include/mysql/psi/mysql_file.h
        Include my_global.h first, to get correct platform definitions.
     @ mysys/ptr_cmp.c
        Hide the unused static functions in #ifdef's on solaris.
        Use __sun (defined by both gcc and SunPro cc) rather than TARGET_OS_SOLARIS
     @ sql/my_decimal.cc
        Include my_global.h first, to get correct platform definitions.
     @ sql/mysqld.cc
        Fix signed/unsigned comparison warning.
     @ sql/sql_audit.h
        Include my_global.h first, to get correct platform definitions.
     @ sql/sql_plugin.h
        Include my_global.h first, to get correct platform definitions.
     @ sql/sql_show.cc
        Fix: warning: cast from pointer to integer of different size
     @ sql/sys_vars.h
        Use reinterpret_cast rather than c-style cast.
     @ storage/perfschema/pfs_instr.cc
        Include my_global.h first, to get correct platform definitions.
[21 Dec 2010 7:24] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/127352

3218 Tor Didriksen	2010-12-20
      Bug #58699 cannot build with gcc dbg on solaris
     @ cmake/os/SunOS.cmake
        Remove TARGET_OS_SOLARIS
     @ config.h.cmake
        Remove TARGET_OS_SOLARIS
        Add PTHREAD_ONCE_INITIALIZER
     @ configure.cmake
        Add function for testing whether we need { PTHREAD_ONCE_INIT } rather than PTHREAD_ONCE_INIT
     @ include/my_pthread.h
        Use PTHREAD_ONCE_INITIALIZER if set by cmake.
     @ include/mysql/psi/mysql_file.h
        Include my_global.h first, to get correct platform definitions.
     @ mysys/ptr_cmp.c
        Hide the unused static functions in #ifdef's on solaris.
        Use __sun (defined by both gcc and SunPro cc) rather than TARGET_OS_SOLARIS
     @ sql/my_decimal.cc
        Include my_global.h first, to get correct platform definitions.
     @ sql/mysqld.cc
        Fix signed/unsigned comparison warning.
     @ sql/sql_audit.h
        Include my_global.h first, to get correct platform definitions.
     @ sql/sql_plugin.h
        Include my_global.h first, to get correct platform definitions.
     @ sql/sql_show.cc
        Fix: warning: cast from pointer to integer of different size
     @ sql/sys_vars.h
        Use reinterpret_cast rather than c-style cast.
     @ storage/perfschema/pfs_instr.cc
        Include my_global.h first, to get correct platform definitions.
[21 Dec 2010 12:49] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/127423

3221 Tor Didriksen	2010-12-21
      Bug #58699 cannot build with gcc dbg on solaris
     @ cmake/os/SunOS.cmake
        Remove TARGET_OS_SOLARIS
     @ config.h.cmake
        Remove TARGET_OS_SOLARIS
        Add PTHREAD_ONCE_INITIALIZER
     @ configure.cmake
        Add function for testing whether we need { PTHREAD_ONCE_INIT } rather than PTHREAD_ONCE_INIT
     @ include/my_pthread.h
        Use PTHREAD_ONCE_INITIALIZER if set by cmake.
     @ include/mysql/psi/mysql_file.h
        Include my_global.h first, to get correct platform definitions.
     @ mysys/ptr_cmp.c
        Hide the unused static functions in #ifdef's on solaris.
        Use __sun (defined by both gcc and SunPro cc) rather than TARGET_OS_SOLARIS
     @ sql/my_decimal.cc
        Include my_global.h first, to get correct platform definitions.
     @ sql/mysqld.cc
        Fix signed/unsigned comparison warning.
     @ sql/sql_audit.h
        Include my_global.h first, to get correct platform definitions.
     @ sql/sql_plugin.h
        Include my_global.h first, to get correct platform definitions.
     @ sql/sql_show.cc
        Fix: warning: cast from pointer to integer of different size
     @ sql/sys_vars.h
        Use reinterpret_cast rather than c-style cast.
     @ storage/perfschema/pfs_instr.cc
        Include my_global.h first, to get correct platform definitions.
[21 Dec 2010 15:37] Tor Didriksen
Pushed to 5.5-bugteam and trunk-bugfixing
[22 Dec 2010 21:30] Bugs System
Pushed into mysql-trunk 5.6.1 (revid:alexander.nozdrin@oracle.com-20101222212842-y0t3ibtd32wd9qaw) (version source revid:alexander.nozdrin@oracle.com-20101222212842-y0t3ibtd32wd9qaw) (merge vers: 5.6.1) (pib:24)
[29 Dec 2010 12:53] Bugs System
Pushed into mysql-5.5 5.5.9 (revid:alexander.nozdrin@oracle.com-20101229113652-km2v993aurv7h79j) (version source revid:alexander.nozdrin@oracle.com-20101229113132-uonlbcc2uopff8yb) (merge vers: 5.5.9) (pib:24)
[6 Jan 2011 1:15] Paul DuBois
Noted in 5.5.9 changelog.

On Solaris, the MySQL build failed if it was configured with
debugging enabled.
[8 Feb 2011 17:58] Todd Rinaldo
I had to apply this to 5.1.54 to get 5.1.54 compiling on some systems

Attachment: gcc_5154.patch (application/octet-stream, text), 1007 bytes.

[8 Feb 2011 18:00] Todd Rinaldo
FYI the systems in question were linux.