Bug #20436 Build fails on mysqld.cc
Submitted: 13 Jun 2006 17:11 Modified: 30 Jun 2006 6:26
Reporter: James Baldassari Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.22 OS:Solaris (Solaris 8)
Assigned to: Sveta Smirnova CPU Architecture:Any

[13 Jun 2006 17:11] James Baldassari
Description:
Using gcc 2.95.3 the MySQL Server build fails in the init_common_variables function in mysqld.cc:

Making all in sql
make  all-recursive
Making all in share
source='mysqld.cc' object='mysqld.o' libtool=no \
DEPDIR=.deps depmode=gcc /bin/bash ../depcomp \
/usr/local/bin/g++ -DMYSQL_SERVER  -DDEFAULT_MYSQL_HOME="\"/sun_users/baldasj/my
sql\""  -DDATADIR="\"/sun_users/baldasj/mysql/var\""  -DSHAREDIR="\"/sun_users/b
aldasj/mysql/share/mysql\""  -DHAVE_CONFIG_H -I. -I. -I.. -I../innobase/include
  -I../include -I../include  -I../regex -I.        -O3 -DDBUG_OFF    -fno-implic
it-templates -fno-exceptions -fno-rtti -D_FILE_OFFSET_BITS=64 -DHAVE_CURSES_H -I
/sun_users/baldasj/src/mysql/mysql-5.0.22/include -DHAVE_RWLOCK_T -DUSE_PRAGMA_I
MPLEMENTATION -c -o mysqld.o mysqld.cc
mysqld.cc: In function `int init_common_variables(const char *, int, char **, co
nst char **)':
mysqld.cc:2573: implicit declaration of function `int localtime_r(...)'
*** Error code 1
make: Fatal error: Command failed for target `mysqld.o'
Current working directory /sun_users/baldasj/src/mysql/mysql-5.0.22/sql
*** Error code 1
make: Fatal error: Command failed for target `all-recursive'
Current working directory /sun_users/baldasj/src/mysql/mysql-5.0.22/sql
*** Error code 1
make: Fatal error: Command failed for target `all'
Current working directory /sun_users/baldasj/src/mysql/mysql-5.0.22/sql
*** Error code 1
make: Fatal error: Command failed for target `all-recursive'
Current working directory /sun_users/baldasj/src/mysql/mysql-5.0.22
*** Error code 1
make: Fatal error: Command failed for target `all'

How to repeat:
$ CC="/usr/local/bin/gcc" CXX="/usr/local/bin/g++" ./configure --without-docs --without-man --without-bench --enable-shared --prefix="$HOME/mysql"
$ make

Suggested fix:
Maybe time.h isn't getting included, but I haven't had time to look into it.
[19 Jun 2006 8:10] Sveta Smirnova
I can't repeat it using last 5.0.23 sources, gcc 2.95.3, Solaris 10 and following all instruction from http://dev.mysql.com/doc/refman/5.0/en/solaris.html.

Please, also notice we really do not use gcc 2.95.3 on Solaris and have not machine with both Solaris 8 and gcc 2.95.3.
[29 Jun 2006 20:33] ubaidul khan
I am getting the same error:

rver/mysql-5.0.21/include -DHAVE_RWLOCK_T -DUSE_PRAGMA_IMPLEMENTATION -c -o mysqld.o mysqld.cc
mysqld.cc: In function `int init_common_variables(const char *, int, char **, const char **)':
mysqld.cc:2573: implicit declaration of function `int localtime_r(...)'
make[4]: *** [mysqld.o] Error 1

How can I get the 5.0.23 source?  Thanks
[30 Jun 2006 6:23] Sveta Smirnova
Thank you for the additional information. Information about accessing the source trees is available at http://www.mysql.com/doc/en/Installing_source_tree.html
[8 Oct 2006 12:36] Anders Karlsson
I get this problem too when building 5.1.11 on Solaris 9 with gcc 2.95.3. It seems to fail on localtime_r, gmtime_r etc. There seems to be some problem with the order that files are included in and the definition of _REENTRANT, at least that is what it seems to be, but I hevn't looked into it in that much detail.
[2 Dec 2006 2:57] David White
I also get this when compiling the 5.0.27 source on Solaris 8.  I solved the problem by modifying my configure command this way:

> CFLAGS="-D_REENTRANT" CXXFLAGS="-D_REENTRANT" ./configure --prefix=/usr/local