Bug #36114 with-ndb-test fails to compile on OS X Leopard
Submitted: 16 Apr 2008 6:49 Modified: 28 Apr 2008 13:18
Reporter: Jay Edwards Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:6.0.4-alpha OS:MacOS (10.5.2)
Assigned to: Geert Vanderkelen CPU Architecture:Any

[16 Apr 2008 6:49] Jay Edwards
Description:

merlot:test jayed$ pwd
/opt/mysql60/mysql-6.0.4-alpha/storage/ndb/test
merlot:test jayed$ gmake
Making all in src
gmake[1]: Entering directory `/opt/mysql60/mysql-6.0.4-alpha/storage/ndb/test/src'
if g++ -DHAVE_CONFIG_H -DNDEBUG   -I. -I. -I../../../../include -I../../../../storage/ndb/src/common/mgmcommon -I../../../../storage/ndb/include/mgmcommon -I../../../../storage/ndb/include/kernel -I../../../../storage/ndb/src/mgmapi -I../../../.. -I../../../../include -I../../../../storage/ndb/include -I../../../../include -I../../../../storage/ndb/include -I../../../../storage/ndb/include/ndbapi -I../../../../storage/ndb/include/util -I../../../../storage/ndb/include/portlib -I../../../../storage/ndb/test/include -I../../../../storage/ndb/include/mgmapi      -O3    -fno-implicit-templates -fno-exceptions -fno-rtti -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT  -DDONT_DECLARE_CXA_PURE_VIRTUAL -MT dbutil.o -MD -MP -MF ".deps/dbutil.Tpo" -c -o dbutil.o dbutil.cpp; \
	then mv -f ".deps/dbutil.Tpo" ".deps/dbutil.Po"; else rm -f ".deps/dbutil.Tpo"; exit 1; fi
dbutil.cpp: In member function ‘long unsigned int dbutil::SelectCountTable(const char*)’:
dbutil.cpp:166: error: ‘ulong’ was not declared in this scope
dbutil.cpp:166: error: expected `;' before ‘strtoull’
gmake[1]: *** [dbutil.o] Error 1
gmake[1]: Leaving directory `/opt/mysql60/mysql-6.0.4-alpha/storage/ndb/test/src'
gmake: *** [all-recursive] Error 1
merlot:test jayed$ 

How to repeat:
merlot:test jayed$ gmake --version
GNU Make 3.81

merlot:test jayed$ gcc -v
Using built-in specs.
Target: i686-apple-darwin9
...
Thread model: posix
gcc version 4.0.1 (Apple Inc. build 5465)

./configure --prefix=/opt/mysql60/ --enable-local-infile --with-charset=utf8 --with-extra-charsets=all  --with-fast-mutexes --with-atomic-cpus=smp --with-max-indexes=128  --with-comment --with-libevent --with-plugins=all --with-ndb-test --with-ndb-docs --with-ndb-port=9999 --with-ndb-port-base=10000
[16 Apr 2008 19:43] Jay Edwards
grep -R 'define ulong ' ./* in the mysql source tree returns nothing. So, apparently, this is expected to be defined by the system headers.
[16 Apr 2008 19:48] Jay Edwards
Apparently, there is no ulong defined outside of some Python and php frameworks on my system. I've checked /usr/include and both the 10.4 and 10.5 SDKs.

merlot:MacOSX10.5.sdk jayed$ find . -type f -name '*.h' | xargs grep -R 'define ulong ' 
./System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/numpy/core/include/numpy/noprefix.h:#define ulong       npy_ulong
./System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/numpy/core/include/numpy/noprefix.h:#define ulong       npy_ulong
./usr/include/php/main/php_config.h:#define ulong unsigned long 
merlot:MacOSX10.5.sdk jayed$ cd ..
merlot:SDKs jayed$ cd MacOSX10.4u.sdk/
merlot:MacOSX10.4u.sdk jayed$ find . -type f -name '*.h' | xargs grep -R 'define ulong ' 
./usr/include/php/main/php_config.h:#define ulong unsigned long 
merlot:MacOSX10.4u.sdk jayed$ find /usr/include -type f -name '*.h' | xargs grep -R 'define ulong ' 
/usr/include/php/main/php_config.h:#define ulong unsigned long 
merlot:MacOSX10.4u.sdk jayed$
[16 Apr 2008 20:35] Geert Vanderkelen
Hi Jay,

We did hack on this at the MySQL booth, and this looks like more a MacOS specific problem.

So the ulong type is defined in sys/types.h on Linux, somehow on Mac that ain't going well, for those brave enough to try --with-ndb-test :)

Fix would be to edit storage/ndb/test/include/NdbTest.hpp and include my_globals.hpp:
  #include <my_global.h>

Or fixing dbutil.cpp

unsigned long dbutil::SelectCountTable(const char * table)
{
 ..
 count= (unsigned long) strtoull(row[0], (char**) 0, 10);

So, changing (ulong) to (unsigned long). It was more or less a 'long' typo (no pun intended) :)

I'll patch it.
[28 Apr 2008 13:18] Geert Vanderkelen
MySQL 6.0 from bk, storage/ndb/test/src has changed lots. dbutil.cpp is not there anymore, instead DbUtil.cpp is available.

Putting this report as "Can't repeat", so stay tuned for next release..