Bug #35814 make error daemon_example.cc:54: implicit declaration of function `int localtime
Submitted: 3 Apr 2008 18:49 Modified: 5 Apr 2008 16:45
Reporter: Keith Wright Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.1.23-rc OS:Solaris (Solaris 8 02/04, SPARC)
Assigned to: CPU Architecture:Any
Tags: implicit declaration of function, int localtime

[3 Apr 2008 18:49] Keith Wright
Description:
Make fails with the following error.  Confirmed on two separate systems.  Doing a make on 5.1.23-rc on Solaris 8 02/04 gets this error.

----------cut from make output ------------
/mysql-5.1.23-rc/include -DHAVE_RWLOCK_T -DUSE_PRAGMA_IMPLEMENTATION -c -o libdaemon_example_la-daemon_example.lo `test -f 'daemon_example.cc' || echo './'`daemon_example.cc
mkdir .libs
g++ -DHAVE_CONFIG_H -I. -I. -I../../include -I../../include -I../../include -I../../regex -I../../sql -I. -I../../zlib -DMYSQL_DYNAMIC_PLUGIN -O3 -fno-implicit-templates -fno-exceptions -fno-rtti -D_FILE_OFFSET_BITS=64 -DHAVE_CURSES_H -I/root/mysql-5.1.23-rc/include -DHAVE_RWLOCK_T -DUSE_PRAGMA_IMPLEMENTATION -c daemon_example.cc -Wp,-MD,.deps/libdaemon_example_la-daemon_example.TPlo  -fPIC -DPIC -o .libs/libdaemon_example_la-daemon_example.o
daemon_example.cc: In function `void * mysql_heartbeat(void *)':
daemon_example.cc:54: implicit declaration of function `int localtime_r(...)'
*** Error code 1
make: Fatal error: Command failed for target `libdaemon_example_la-daemon_example.lo'
Current working directory /root/mysql-5.1.23-rc/plugin/daemon_example
*** Error code 1
make: Fatal error: Command failed for target `all-recursive'
Current working directory /root/mysql-5.1.23-rc/plugin
*** Error code 1
make: Fatal e

How to repeat:
Solaris 8 04/04 SPARC (Install everything and OEM)
gcc 2.95.3 (from www.sunfreeware.com)

useradd -g mysql mysql 
cd mysql-5.1.23-rc
./configure --prefix=/usr/local/mysql 
make
[4 Apr 2008 6:26] Valeriy Kravchuk
Thank you for a problem report. 

Usually (http://dev.mysql.com/doc/refman/5.0/en/mysql-binaries.html) the following options are recommended for gcc:

-fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti

Please, check if setting these will make any difference.
[5 Apr 2008 0:27] Keith Wright
Thank you for the pointer on the build commands for Solaris 8 SPARC 64.   I was able to successfully build MySQL 5.1.23-rc.     Sorry about the false alarm.   I was using the build instructions in the reference manual (that do not include the extra settings required to build on Solaris).

Thank you!

--keith
[5 Apr 2008 8:05] Valeriy Kravchuk
So, this is not a bug.
[5 Apr 2008 16:45] Keith Wright
It is not a bug unless it will be considered a documentation bug.  The MySQL reference manual 'build' instructions are incomplete in that they do not include the necessary instructions on from link you provided at  (http://dev.mysql.com/doc/refman/5.0/en/mysql-binaries.html).   Two people (me and a Sun customer) independently generated the error reported in this case.  We got the same error using two different compilers (Sun Studio 12 and gcc).

My recommendation would be to update the MySQL reference manual to include a link to the page you provided  for detailed instructions to build MySQL (http://dev.mysql.com/doc/refman/5.0/en/mysql-binaries.html).

Thank you!

--keith
[2 Dec 2008 16:06] stephane picard
Hi all,
i am facing the same issue on solaris 8 (despite the fact that -i think- i applied all the advices i found here) :

@eus021%uname -a
SunOS eus021 5.8 Generic_108528-19 sun4u sparc SUNW,Ultra-250

@eus021%env
HOSTTYPE=sun4
VENDOR=sun
OSTYPE=solaris
MACHTYPE=sparc
PWD=/devel/sources/mysql/mysql-5.1.30
CC=gcc
CFLAGS=-O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti
CPPFLAGS=-I/opt/STMtools/STMopenssl/include
CXX=gcc
CXXFLAGS=-O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti

@eus021%./configure --prefix=/opt/STMtools/STMmysql --with-ssl=/opt/STMtools/STMopenssl
(...)

@eus021%make
(...)gcc -DHAVE_CONFIG_H -I. -I../../include -I../../include -I../../include -I../../regex -I../../sql -I. -I../../zlib -I/opt/STMtools/STMopenssl/include -DMYSQL_DYNAMIC_PLUGIN -O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti -fno-implicit-templates -fno-exceptions -fno-rtti -D_FILE_OFFSET_BITS=64 -DHAVE_CURSES_H -I/devel/sources/mysql/mysql-5.1.30/include -DHAVE_RWLOCK_T -DUSE_PRAGMA_IMPLEMENTATION -c daemon_example.cc -Wp,-MD,.deps/libdaemon_example_la-daemon_example.TPlo  -fPIC -DPIC -o .libs/libdaemon_example_la-daemon_example.o
daemon_example.cc: In function `void * mysql_heartbeat(void *)':
daemon_example.cc:54: implicit declaration of function `int localtime_r(...)'
*** Error code 1
make: Fatal error: Command failed for target `libdaemon_example_la-daemon_example.lo'
Current working directory /devel/sources/mysql/mysql-5.1.30/plugin/daemon_example
*** Error code 1
make: Fatal error: Command failed for target `all-recursive'
Current working directory /devel/sources/mysql/mysql-5.1.30/plugin
*** Error code 1
make: Fatal error: Command failed for target `all-recursive'

Any clue to help ?
Thanks a lot!
With Regards,
Stephane