Bug #35670 6.0 build under Win32 broken in at least two places due to codebase problems
Submitted: 29 Mar 2008 12:23 Modified: 16 May 2008 13:39
Reporter: Toby Douglass Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S1 (Critical)
Version:6.0 OS:Windows
Assigned to: MC Brown CPU Architecture:Any
Tags: 6.0, Broken, build, problem, win32

[29 Mar 2008 12:23] Toby Douglass
Description:
I'm attempting to build 6.0 under Win32.

I have what I believe is a correctly configured environment; I can build 5.0 with my environment.

Upon issuing the make, I come first to an error with strings/dtoa.c - namely, there is in Cygwin already a function called dtoa(), which clashes with a function in dtoa.c also called dtoa().  The function in dtoa.c is static, so renaming it and all its uses in dtoa.c solves this problem.

Upon reissuing the make, I then later come to the next problem; client.c is broken.  I get this little lot of errors;

client.c: In function `mysql_real_connect':
client.c:2010: error: storage size of 'hints' isn't known
client.c:2012: error: `NI_MAXSERV' undeclared (first use in this function)
client.c:2012: error: (Each undeclared identifier is reported only once
client.c:2012: error: for each function it appears in.)
client.c:2060: error: dereferencing pointer to incomplete type
client.c:2060: error: dereferencing pointer to incomplete type
client.c:2061: error: dereferencing pointer to incomplete type
client.c:2080: error: dereferencing pointer to incomplete type
client.c:2080: error: dereferencing pointer to incomplete type

So, basically, "hints" is an incomplete type still and NI_MAXSERV hasn't been defined.  Someone forget to check in an updated file?

How to repeat:
Build 6.0 under Windows.

Suggested fix:
Rename the static dtoa() function in dtoa.c, because you can't go about renaming functions in Cygwin stdlib.h!
[29 Mar 2008 12:23] Toby Douglass
typo
[29 Mar 2008 12:44] Toby Douglass
Oh - and "NI_MAXSERV" is only *used* and is never defined in any way in any file in the 6.0 code base.

(E.g. findstr /s /n /c:"NI_MAXSERV" * returns only matches where NI_MAXSERV is being used).
[29 Mar 2008 12:58] MySQL Verification Team
Thank you for the bug report. What exactly the source package you are trying
to compile? I will test but with the Visual Studio compiler which is currently
the only one supported in our build procedures on Windows. Thanks in advance.
[29 Mar 2008 13:04] Toby Douglass
The source package is that obtained by issuing the command;

bkf clone bk://mysql.bkbits.net/mysql-6.0 mysql-6.0

I understand this is the current version of the repository.

The build instructions I've followed are here;

http://dev.mysql.com/doc/refman/6.0/en/installing-source-tree.html
[29 Mar 2008 14:40] Toby Douglass
Note - my MS build environment is the command line compiler MS offer (e.g. not the VC++ GUI, but the same compiler) plus the latest platform SDK.
[29 Mar 2008 14:49] Toby Douglass
Actually, that's incorrect... the makefile is of course using the gcc which came with Cygwin.
[29 Mar 2008 15:34] MySQL Verification Team
I was able to compile the latest source, below the steps I did according our
instructions in the Manual:

http://dev.mysql.com/doc/refman/6.0/en/windows-source-build.html

c:\dbs\mysql-6.0>win\configure WITH_INNOBASE_STORAGE_ENGINE WITH_PARTITION_STORAGE_ENGINE WITH_ARCHIVE_STORAGE_ENGI
NE WITH_BLACKHOLE_STORAGE_ENGINE WITH_EXAMPLE_STORAGE_ENGINE WITH_FEDERATED_STORAGE_ENGINE WITH_FALCON_STORAGE_ENGI
NE WITH_INNOBASE_STORAGE_ENGINE __NT__ MYSQL_SERVER_SUFFIX=-nt

c:\dbs\mysql-6.0>win\build-vs8.bat
O sistema não pode encontrar o arquivo especificado.
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 8/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 8/VC/bin/cl.exe -- works
-- Check size of void*
-- Check size of void* - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 8/VC/bin/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 8/VC/bin/cl.exe -- works
-- Configuring done
-- Generating done
-- Build files have been written to: C:/dbs/mysql-6.0
        1 arquivo(s) copiado(s).

Then using the VS2005 GUI environment:

c:\dbs\mysql-6.0>sql\release\mysqld -V
sql\release\mysqld  Ver 6.0.5-alpha-nt for Win32 on ia32 (Source distribution)
[29 Mar 2008 18:04] Toby Douglass
Hmm.

So, this page; 

http://dev.mysql.com/doc/refman/6.0/en/installing-source-tree.html

Instructs to use Cygwin to build under Windows (which works for 5.0, where there are no source code issues, but fails for 6.0, since there are, when using this method).

However, this page, (which you specify);

http://dev.mysql.com/doc/refman/6.0/en/windows-source-build.html

Instructs to build using CMake et al, which works.

There appear to be two methods documented to build under Windows, one of which is broken.
[31 Mar 2008 16:52] MySQL Verification Team
Thank you for the bug report.
[16 May 2008 13:39] MC Brown
The current 'Installing Source' page only says to use Cygwin to build the BK free client - it doesn't say to use it to build MySQL itself. 

The rest of the instructions though are misleading for Windows users, so I've now added a link immediately after the BK section pointing you to the correct Windows source build instructions. 

This has been added to both the 5.1 and 6.0 manuals, since the two use the same basic sequence.