Bug #52755 Compilation error when compiling my_init.c without CMake
Submitted: 12 Apr 2010 8:18 Modified: 28 Apr 2010 2:11
Reporter: Olav Sandstå Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S1 (Critical)
Version:6.0.14 OS:Any
Assigned to: Mats Kindahl CPU Architecture:Any

[12 Apr 2010 8:18] Olav Sandstå
Description:
When compiling the latest 6.0 source code I get the following compilation error when compiling on Solaris 10 using the Sun Studio compiler:

libtool: compile:  /opt/studio12/SUNWspro/bin/cc -DDEFAULT_CHARSET_HOME=\"/home/os136802/install/mysql6\" -DMYSQL_DATADIR=\"/home/os136802/install/mysql6/var\" -DDEFAULT_HOME_ENV=MYSQL_HOME -DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX -DDEFAULT_SYSCONFDIR=\"/home/os136802/install/mysql6/etc\" -DSHAREDIR=\"/home/os136802/install/mysql6/share/mysql\" -DDISABLE_DTRACE -DMYSQL_CLIENT_NO_THREADS -DDONT_USE_RAID -DDISABLE_MYSQL_THREAD_H -I. -I../include -I../include -I../zlib -g -DSAFE_MUTEX -Xa -m64 -mt -g -xcode=pic32 -DHAVE_RWLOCK_T -DUNIV_SOLARIS -c my_init.c  -KPIC -DPIC -o .libs/my_init.o
"../include/my_no_pthread.h", line 41: warning: macro redefined: pthread_mutex_init
"../include/my_no_pthread.h", line 42: warning: macro redefined: pthread_mutex_lock
"../include/my_no_pthread.h", line 43: warning: macro redefined: pthread_mutex_unlock
"../include/my_no_pthread.h", line 44: warning: macro redefined: pthread_mutex_destroy
"../include/my_no_pthread.h", line 45: warning: macro redefined: my_rwlock_init
"../include/my_no_pthread.h", line 46: warning: macro redefined: rw_rdlock
"../include/my_no_pthread.h", line 47: warning: macro redefined: rw_wrlock
"../include/my_no_pthread.h", line 48: warning: macro redefined: rw_unlock
"../include/my_no_pthread.h", line 49: warning: macro redefined: rwlock_destroy
"../include/my_no_pthread.h", line 51: identifier redeclared: pthread_once_t
        current : int
        previous: struct _once {array[4] of unsigned long __pthread_once_pad} : "/usr/include/sys/types.h", line 464
"../include/my_no_pthread.h", line 52: warning: macro redefined: MY_PTHREAD_ONCE_INIT
"../include/my_no_pthread.h", line 55: warning: macro redefined: my_pthread_once
cc: acomp failed for my_init.c
make[2]: *** [my_init.lo] Error 1

How to repeat:
1. Check out the latest source code from mysql-6.0-codebase-bugfixing (or mysql-6.0-codebase)

2. ./BUILD/autorun.sh

3. ./configure CC=/opt/studio12/SUNWspro/bin/cc CXX=/opt/studio12/SUNWspro/bin/CC CFLAGS="-Xa -m64 -mt -g -xcode=pic32" CXXFLAGS="-m64 -mt -g -xcode=pic32" --prefix=/home/os136802/install/mysql6 --with-client-ldflags=-static --with-plugins=myisam,innobase,perfschema --enable-dtrace --with-debug 

4. make
[12 Apr 2010 8:54] Marc ALFF
Also reproduced on Mac with 6.0-codebase.

Note the usage of both my_pthread.h and my_no_pthread.h.

Making all in libmysql
make  all-am
/bin/sh ../libtool --preserve-dup-deps  --tag=CC   --mode=compile gcc --pipe -DDEFAULT_CHARSET_HOME="\"/usr/local/mysql\"" -DMYSQL_DATADIR="\"/usr/local/mysql/var\"" -DDEFAULT_HOME_ENV=MYSQL_HOME -DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX -DDEFAULT_SYSCONFDIR="\"/usr/local/mysql/etc\"" -DSHAREDIR="\"/usr/local/mysql/share/mysql\"" -DDISABLE_DTRACE -DMYSQL_CLIENT_NO_THREADS -DDONT_USE_RAID -DDISABLE_MYSQL_THREAD_H  -I. -I../include  -I../include  -I../zlib   -g -DSAFE_MUTEX -DSAFEMALLOC -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Wunused-function -Wunused-label -Wunused-value -Wunused-variable -Wunused-parameter -Wno-format-zero-length -mtune=native -m64 -DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS  -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX   -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT  -DDONT_DECLARE_CXA_PURE_VIRTUAL -MT my_init.lo -MD -MP -MF .deps/my_init.Tpo -c -o my_init.lo my_init.c
libtool: compile:  gcc --pipe -DDEFAULT_CHARSET_HOME=\"/usr/local/mysql\" -DMYSQL_DATADIR=\"/usr/local/mysql/var\" -DDEFAULT_HOME_ENV=MYSQL_HOME -DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX -DDEFAULT_SYSCONFDIR=\"/usr/local/mysql/etc\" -DSHAREDIR=\"/usr/local/mysql/share/mysql\" -DDISABLE_DTRACE -DMYSQL_CLIENT_NO_THREADS -DDONT_USE_RAID -DDISABLE_MYSQL_THREAD_H -I. -I../include -I../include -I../zlib -g -DSAFE_MUTEX -DSAFEMALLOC -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Wunused-function -Wunused-label -Wunused-value -Wunused-variable -Wunused-parameter -Wno-format-zero-length -mtune=native -m64 -DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL -MT my_init.lo -MD -MP -MF .deps/my_init.Tpo -c my_init.c  -fno-common -DPIC -o .libs/my_init.o
In file included from mysys_priv.h:67,
                 from my_init.c:16:
../include/my_no_pthread.h:41:1: warning: "pthread_mutex_init" redefined
In file included from ../include/my_sys.h:1092,
                 from mysys_priv.h:17,
                 from my_init.c:16:
../include/my_pthread.h:523:1: warning: this is the location of the previous definition
In file included from mysys_priv.h:67,
                 from my_init.c:16:
../include/my_no_pthread.h:42:1: warning: "pthread_mutex_lock" redefined
In file included from ../include/my_sys.h:1092,
                 from mysys_priv.h:17,
                 from my_init.c:16:
../include/my_pthread.h:524:1: warning: this is the location of the previous definition
In file included from mysys_priv.h:67,
                 from my_init.c:16:
../include/my_no_pthread.h:43:1: warning: "pthread_mutex_unlock" redefined
In file included from ../include/my_sys.h:1092,
                 from mysys_priv.h:17,
                 from my_init.c:16:
../include/my_pthread.h:526:1: warning: this is the location of the previous definition
In file included from mysys_priv.h:67,
                 from my_init.c:16:
../include/my_no_pthread.h:44:1: warning: "pthread_mutex_destroy" redefined
In file included from ../include/my_sys.h:1092,
                 from mysys_priv.h:17,
                 from my_init.c:16:
../include/my_pthread.h:527:1: warning: this is the location of the previous definition
In file included from mysys_priv.h:67,
                 from my_init.c:16:
../include/my_no_pthread.h:45:1: warning: "my_rwlock_init" redefined
In file included from ../include/my_sys.h:1092,
                 from mysys_priv.h:17,
                 from my_init.c:16:
../include/my_pthread.h:598:1: warning: this is the location of the previous definition
In file included from mysys_priv.h:67,
                 from my_init.c:16:
../include/my_no_pthread.h:46:1: warning: "rw_rdlock" redefined
In file included from ../include/my_sys.h:1092,
                 from mysys_priv.h:17,
                 from my_init.c:16:
../include/my_pthread.h:599:1: warning: this is the location of the previous definition
In file included from mysys_priv.h:67,
                 from my_init.c:16:
../include/my_no_pthread.h:47:1: warning: "rw_wrlock" redefined
In file included from ../include/my_sys.h:1092,
                 from mysys_priv.h:17,
                 from my_init.c:16:
../include/my_pthread.h:600:1: warning: this is the location of the previous definition
In file included from mysys_priv.h:67,
                 from my_init.c:16:
../include/my_no_pthread.h:48:1: warning: "rw_unlock" redefined
In file included from ../include/my_sys.h:1092,
                 from mysys_priv.h:17,
                 from my_init.c:16:
../include/my_pthread.h:603:1: warning: this is the location of the previous definition
In file included from mysys_priv.h:67,
                 from my_init.c:16:
../include/my_no_pthread.h:49:1: warning: "rwlock_destroy" redefined
In file included from ../include/my_sys.h:1092,
                 from mysys_priv.h:17,
                 from my_init.c:16:
../include/my_pthread.h:604:1: warning: this is the location of the previous definition
In file included from mysys_priv.h:67,
                 from my_init.c:16:
../include/my_no_pthread.h:51: error: conflicting types for ‘pthread_once_t’
/usr/include/sys/types.h:338: error: previous declaration of ‘pthread_once_t’ was here
In file included from mysys_priv.h:67,
                 from my_init.c:16:
../include/my_no_pthread.h:52:1: warning: "MY_PTHREAD_ONCE_INIT" redefined
In file included from ../include/my_sys.h:1092,
                 from mysys_priv.h:17,
                 from my_init.c:16:
../include/my_pthread.h:212:1: warning: this is the location of the previous definition
In file included from mysys_priv.h:67,
                 from my_init.c:16:
../include/my_no_pthread.h:55:1: warning: "my_pthread_once" redefined
In file included from ../include/my_sys.h:1092,
                 from mysys_priv.h:17,
                 from my_init.c:16:
../include/my_pthread.h:213:1: warning: this is the location of the previous definition
make[2]: *** [my_init.lo] Error 1
[12 Apr 2010 9:33] Sveta Smirnova
Thank you for the report.

Verified as described.
[12 Apr 2010 13:06] Alexander Nozdrin
It's happens on Linux also.

It seems to be present anywhere when building using old scheme (without CMake).
[14 Apr 2010 12:50] 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/105643

3867 Tor Didriksen	2010-04-14
      Bug #52755  	Compilation error when compiling my_init.c without CMake
      
      Cleanup inclusion of my_pthread.h and my_sys.h
[20 Apr 2010 5:39] 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/106065

3862 Tor Didriksen	2010-04-14
      Bug #52755  	Compilation error when compiling my_init.c without CMake
      
      Cleanup inclusion of my_pthread.h and my_sys.h
[20 Apr 2010 14:28] 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/106111

3864 Tor Didriksen	2010-04-14
      Bug #52755  	Compilation error when compiling my_init.c without CMake
      
      Cleanup inclusion of my_pthread.h and my_sys.h
[21 Apr 2010 6:06] 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/106173

3865 Tor Didriksen	2010-04-14
      Bug #52755  	Compilation error when compiling my_init.c without CMake
      
      Cleanup inclusion of my_pthread.h and my_sys.h
[21 Apr 2010 8:15] 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/106195

3827 Tor Didriksen	2010-04-14
      Bug #52755  	Compilation error when compiling my_init.c without CMake
      
      Cleanup inclusion of my_pthread.h and my_sys.h
[21 Apr 2010 8:45] Tor Didriksen
Pushed to
bzr+ssh://bk-internal.mysql.com/bzrroot/server/mysql-6.0-codebase-bugfixing/
[27 Apr 2010 9:45] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100427094135-5s49ecp3ckson6e2) (version source revid:alik@sun.com-20100427093843-uekr85qkd7orx12t) (merge vers: 6.0.14-alpha) (pib:16)
[28 Apr 2010 2:11] Paul DuBois
Not in any released version. No changelog entry needed.