Bug #1585 Compilation error on AIX
Submitted: 17 Oct 2003 5:43 Modified: 29 Jan 2004 6:32
Reporter: Richard van Denzel Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Compiling Severity:S2 (Serious)
Version:4.0.15a OS:IBM AIX (AIX 5.2)
Assigned to: Michael Widenius CPU Architecture:Any

[17 Oct 2003 5:43] Richard van Denzel
Description:
When compiling the release I run into the following error:

  g++ -DUNDEF_THREADS_HACK -I. -I. -I.. -I./../include  -I../include -I./.. -I..
  -I..      -O3 -DDBUG_OFF   -fno-implicit-templates -fno-exceptions -fno-rtti -
c -o sql_string.o `test -f sql_string.cc || echo './'`sql_string.cc
sql_string.cc: In method `bool String::set (double, unsigned int)':
sql_string.cc:180: implicit declaration of function `int snprintf (...)'
make: 1254-004 The error code from the last command is 1.

Please help.

How to repeat:
make
[17 Oct 2003 5:47] Richard van Denzel
Configured it with:

CC="gcc -pipe -mcpu=power -Wa,-many"
CFLAGS="-felide-contructors -fno-exceptions -fno-rtti"
CXX="gcc -pipe -mcpu=power -Wa,-many"
CXXFLAGS="-felide-contructors -fno-exceptions -fno-rtti"

./configure --prefix=/usr/local --with-low-memory
[22 Oct 2003 10:13] Boyd Gerber
I have verified this one a clients AIX5.2 Machine
[4 Nov 2003 6:30] Richard van Denzel
When compiling with GCC 3.3.2 I get the same errors as reported in Bug-report 1676 (when compiling MySQL 4.0.16).
[11 Dec 2003 16:40] Michael Widenius
Sorry but we can't repeat this as we don't have access to an AIX 5.2 box to debug this.  MySQL 4.0.17 compiles perfectly on the AIX 5.1 box we can access.

The compiler failure is quite strange as configure.in checks if snprintf() exists and defines HAVE_SNPRINTF in this case

The code that gives an error is:

ifdef HAVE_SNPRINTF
  buff[sizeof(buff)-1]=0;                       // Safety
  snprintf(buff,sizeof(buff)-1, "%.*f",(int) decimals,num);
#else
...

The question is "Why is snprintf() not defined in the system include file (should be stdio.h, included from my_global.h)".

The reason I can come up with are:
- snprintf() is somehow missing from the include files.
- Some compiler bug
- Some bug in the include files
- The compiler needs some special option to enable snprintf

One way to find out is to take the compile line but replace "-o sql_string.o" with -E -o sql_string.cpp and attach the .ccp file to this bug report.

Regards,
Monty
[12 Dec 2003 2:34] Richard van Denzel
I can't access my AIX 5.2 right now. I will try it sometime next week and
let you know the results.
[14 Dec 2003 5:55] Richard van Denzel
I don't have the snprintf error anymore. I've now configured it with:

CFLAGS="-O2 -mcpu=powerpc -Wa,-many"
CXX=gcc
CXXFLAGS="-O2 -mcpu=powerpc -Wa,-many -felide-constructors -fno-exceptions -fno-
rtti"
./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --with-serve
r-suffix="-pro" --enable-threads-safe-client --enable-local-infile --with-named-
z-libs=no --disable-shared

This results in the same curses errors as report in bugreport 1676 for MySQL 4.0.16.
[15 Dec 2003 5:49] MySQL Verification Team
Duplicate of #1676
[29 Jan 2004 6:32] Michael Widenius
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.mysql.com/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to 'Open'.

Thank you for your interest in MySQL.

Additional info:

I am closing this as I can't repeat the original bug.
(Note: this bug reports is not a duplicate of 1676)