Bug #2214 CC: ERROR File = item.h, Line = 401 The identifier strtoll is undefined
Submitted: 25 Dec 2003 16:38 Modified: 4 Feb 2004 9:13
Reporter: Joerg Behrens Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:mysql-4.1.1-alpha OS:Other (IRIX64 6.5.22)
Assigned to: Konstantin Osipov CPU Architecture:Any

[25 Dec 2003 16:38] Joerg Behrens
Description:
export CC=cc
export CFLAGS="-O3 -apo -mp -mips4 -OPT:Olimit=0 -TARG:platform=IP30 -Xcpluscomm -I/usr/local/include -I/usr/freeware/include  -I/usr/include"
export CXXFLAGS="-O3 -mips4"
export LDFLAGS="-mp -W,rpath=/usr/freeware/lib32 -W,rpath=/usr/lib32 "
export CXX=CC
export NOWARN='-woff 1009,1014,1048,1110,1116,1185,1188,1204,1230,1233 -Wl,-woff,85,-woff,84'

./configure --prefix=/usr/local/mysql --without-bench --without-debug; gmake -j2

cc-1020 CC: ERROR File = item.h, Line = 401
  The identifier "strtoll" is undefined.

      value(str_arg[0] == '-' ? strtoll(str_arg,(char**) 0,10) :
                                ^

cc-1020 CC: ERROR File = item.h, Line = 402
  The identifier "strtoull" is undefined.

          (longlong) strtoull(str_arg,(char**) 0,10))
                     ^

cc-1020 CC: ERROR File = item.h, Line = 401
  The identifier "strtoll" is undefined.

      value(str_arg[0] == '-' ? strtoll(str_arg,(char**) 0,10) :
                                ^
cc-1020 CC: ERROR File = item.h, Line = 421
  The identifier "strtoull" is undefined.

      Item_int(str_arg, (longlong) strtoull(str_arg,(char**) 0,10), length) {}
                                   ^

cc-1020 CC: ERROR File = item.h, Line = 402
  The identifier "strtoull" is undefined.

          (longlong) strtoull(str_arg,(char**) 0,10))
                     ^

cc-1020 CC: ERROR File = item.h, Line = 421
  The identifier "strtoull" is undefined.

      Item_int(str_arg, (longlong) strtoull(str_arg,(char**) 0,10), length) {}
                                   ^

cc-1020 CC: ERROR File = item_sum.h, Line = 747
  The identifier "strtoll" is undefined.

      return res ? strtoll(res->c_ptr(),(char**) 0,10) : (longlong) 0;
                   ^

cc-1020 CC: ERROR File = item_sum.h, Line = 747
  The identifier "strtoll" is undefined.

      return res ? strtoll(res->c_ptr(),(char**) 0,10) : (longlong) 0;
                   ^

4 errors detected in the compilation of "sql_handler.cc".
gmake[4]: *** [sql_handler.o] Fehler 2
gmake[4]: *** Warte auf noch nicht beendete Prozesse...
cc-1174 CC: WARNING File = sql_lex.cc, Line = 1178
  The variable "units" was declared but never referenced.

    SELECT_LEX_UNIT *units= 0;
                     ^

4 errors detected in the compilation of "sql_lex.cc".
gmake[4]: *** [sql_lex.o] Fehler 2
gmake[4]: Leaving directory `/usr2/MIPS/mysql-4.1.1-alpha/sql'

Latest 6.5.22 IRIX with Mips CC 7.4.1 compiler with all recent patches. This problem ocours also with the mysql 4.0.x releases. It isnt a 
problem with the old 7.3 cc version. So i think it more cc releated because the 7.4 release supports C99 now.
It look like that 'strtoll' is defined in /usr/include/internal/stdlib_core.h 

#if defined(__c99) || ((_SGIAPI || _ABIAPI) && _NO_ANSIMODE)
extern long long strtoll(const char * __restrict, char ** __restrict, int);
#endif /* __c99 || _SGIAPI || _ABIAPI */

but only when using C99. But using C99 brings a lot of more problems.

uname -R
6.5 6.5.22m
cc -v
MIPSpro Compilers: Version 7.41

regards
Joerg Behrens

How to repeat:
Using recent sgi compiler
[3 Feb 2004 14:47] Konstantin Osipov
The problem is twofold:
- on this platform, you need to use -c99 and -LANG:libc_in_namespace_std=OFF compilation flags to make built-in srtoll/strtoull functions visible to MySQL. Though at configure stage this functions are detected successfully without any flags, you can't use they can't be used in C++ code by default
- we apparently have a bug in our configure script on IRIX, when we replace all CXXFLAGS by "-D_BOOL", so that no user-provided CXXFLAGS are taken into account. We're working on this issue.
[4 Feb 2004 9:13] Konstantin Osipov
Fixed in 4.0:  bk commit - 4.0 tree (konstantin:1.1710)