Bug #20907 Can't compile Windows 5.1 with CMake
Submitted: 7 Jul 2006 17:27 Modified: 4 Sep 2006 13:20
Reporter: Miguel Solorzano Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S2 (Serious)
Version:5.1BK OS:Microsoft Windows (Windows)
Assigned to: Georg Richter CPU Architecture:Any

[7 Jul 2006 17:27] Miguel Solorzano
Description:
Following instructions \win\README file:

Setting environment for using Microsoft Visual Studio .NET 2003 tools.
(If you have another version of Visual Studio or Visual C++ installed and wish
to use its tools from the command line, run vcvars32.bat for that version.)

C:\Documents and Settings\miguel>cd\cygwin\home\miguel\dbs\mysql-5.1

C:\cygwin\home\miguel\dbs\mysql-5.1>win\configure WITH_INNOBASE_STORAGE_ENGINE WITH_PARTITION_STORAGE_ENGINE MYSQL_SERVER_SUFFIX=-pro

C:\cygwin\home\miguel\dbs\mysql-5.1>win\build-vs71.bat
        1 arquivo(s) copiado(s).
CMake Error: Attempt to add link library libmysql which is not a library target to target 3  myTest

-- Configuring done
        1 arquivo(s) copiado(s).

Then:

Step 6
------
From the root of your bk clone, start your build.

For Visual Studio, simply execute mysql.sln.  This will start the IDE and you can click the build solution menu option.

I was unable to find the above solution file.

How to repeat:
See description.
[7 Jul 2006 19:48] Kristian Nielsen
Which version of CMake are you using?

The version used on our build host is:

    $ cmake --version
    cmake version 2.2-patch 3
[7 Jul 2006 22:27] Miguel Solorzano
Below the CMake version I am using:

C:\>CMake --version
cmake version 2.4-patch 2

and the Bison version:

C:\>bison --version
bison (GNU Bison) 2.1
Written by Robert Corbett and Richard Stallman.

Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[13 Jul 2006 19:33] Calvin Sun
There are some reports on problems with CMake 2.4. It is needed to put a warning on the README that CMake 2.2 should be used.
[13 Jul 2006 23:16] Miguel Solorzano
I changed the CMake version and now I was able for to create the MySQL.sln
solution file. However during the compilation process I got now the below
error:

mysqld error PRJ0019: A tool returned an error code from "Building Custom Rule C:/cygwin/home/miguel/mysql-5.1/sql/sql_yacc.cc"

Thanks in advance.
[8 Aug 2006 6:37] Kristian Nielsen
For building from BitKeeper sources, Bison needs to be properly installed. Bison is used to generate the sql_yacc.cc file, so it appears likely that the problem is a missing Bison installation (or that Visual Studio cannot find Bison).

Alternatively, one can build from the source tarball (the common Unix/Windows one), which has the sql_yacc.cc file already generated.
[8 Aug 2006 11:16] Miguel Solorzano
I have Bison in the path environment:

C:\Documents and Settings\miguel>bison --version
bison (GNU Bison) 2.1
Written by Robert Corbett and Richard Stallman.

Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

C:\Documents and Settings\miguel>

Then is Visual Studio cannot find it. Indeed I copied the sql_yacc.cc 
and sql_yacc.h from the Unix compiled source and I am able to compile
on Windows.
[17 Aug 2006 3:09] Miguel Solorzano
I was able for to compile 5.1 (without the need for to copy sql_yacc.cc from
Linux compiled source) following the below steps:

- Installed CMake version: cmake-2.2.3-win32.exe
- Edited environment PATH adding: D:\Program Files\CMake 2.2\bin
- Installed Bison version: bison-2.1.exe
- Copied all the Bison \bin files to: D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin directory.
- Copied the whole Bison \share directory to: D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 directory.

Then:

Setting environment for using Microsoft Visual Studio .NET 2003 tools.
(If you have another version of Visual Studio or Visual C++ installed and wish
to use its tools from the command line, run vcvars32.bat for that version.)

d:\>cd mysql-5.1

d:\mysql-5.1>win\configure WITH_INNOBASE_STORAGE_ENGINE WITH_PARTITION_STORAGE_ENGINE WITH_ARCHIVE_STORAGE_ENGINE WITH_BLACKHOLE_STORAGE_ENGINE WITH_EXAMPLE_STORAGE_ENGINE WITH_FEDERATED_STORAGE_ENGINE WITH_INNOBASE_STORAGE_ENGINE __NT__ MYSQL_SERVER_SUFFIX=-nt

d:\mysql-5.1>win\build-vs71.bat
The system cannot find the file specified.
-- Check for working C compiler: cl
-- Check for working C compiler: cl -- works
-- Check size of void*
-- Check size of void* - done
-- Check for working CXX compiler: cl
-- Check for working CXX compiler: cl -- works
-- Configuring done
-- Generating done
-- Build files have been written to: d:/mysql-5.1
        1 file(s) copied.
d:\mysql-5.1>mysql.sln

Using the VS IDE compiled the release server.

d:\mysql-5.1>cd sql

d:\mysql-5.1\sql>cd release

d:\mysql-5.1\sql\release>mysqld -V
mysqld  Ver 5.1.12-beta-nt for Win32 on ia32 (Source distribution)

If the above procedure then I think this bug could be closed and the
Manual updated.
[28 Aug 2006 15:42] Miguel Solorzano
Bug: http://bugs.mysql.com/bug.php?id=21861 was marked as duplicate of this
one. Notice the libmysqld compilation problems too.
[30 Aug 2006 10:23] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/11065

ChangeSet@1.2287, 2006-08-30 12:17:35+02:00, georg@lmy002.wdf.sap.corp +1 -0
  Fix for bug #20907
  
  CMake versions > 2.4 allow linking to STATIC or SHARED libraries only.
[30 Aug 2006 16:55] Georg Richter
fixed in 5.1.12
[4 Sep 2006 13:20] MC Brown
A note has been added to the changelog to 5.1.12.