I just wanted to share my steps for building MariaDB 5.3 on Windows. (Note, this is not much different than the instructions Wlad posted here).
But, things are not always so smooth, and of course I ran into a couple small issues, so I wanted to share my outputs plus those issues and their solutions (once again many thanks go to Wlad!) for those out there who might encounter the same.
Here are the steps to build:
- Download MariaDB 5.3 and extracted to C:\mariadb-5.3
cmake .. -G "Visual Studio 9 2008"
cmake --build . --config relwithdebinfo --target package
* By making a sub-dir named ‘bld’ and cd’ing into it, you’ll keep all of your build files in their own dir. This way, it is easy to start over (just delete /bld/) and it also keeps your sourcedir clean and looking like it does originally.
** The last command is the build command issued from the command line. You could accomplish the same with the following commands from within Visual Studio:
VS2008: File -> Open -> Solution -> C:\mariadb-5.3\bld\MySql.sln
VS2008: Build -> Build Solution
VS2008: Right-click "PACKAGE" -> Build
-- Building for: Visual Studio 8 2005
-- Check for working C compiler using: Visual Studio 8 2005
-- Check for working C compiler using: Visual Studio 8 2005 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Visual Studio 8 2005
-- Check for working CXX compiler using: Visual Studio 8 2005 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - not found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void *
-- Check size of void * - done
-- Using Aria for temporary tables
build ARCHIVE as static library (libarchive.lib)
build BLACKHOLE as static library (libblackhole.lib)
build CSV as static library (libcsv.lib)
build FEDERATEDX as static library (libfederatedx.lib)
build HEAP as static library (libheap_s.lib)
build ARIA as static library (libaria_s.lib)
build MYISAM as static library (libmyisam_s.lib)
build MYISAMMRG as static library (libmyisammrg_s.lib)
build PBXT as static library (libpbxt_s.lib)
build XTRADB as static library (libxtradb.lib)
build FEEDBACK as static library (libfeedback.lib)
build EXAMPLE as DLL (ha_example.dll)
build FEDERATED as DLL (ha_federated.dll)
build INNODB_PLUGIN as DLL (ha_innodb_plugin.dll)
-- Could NOT find Boost
-- Performing Test BOOST_OK
-- Performing Test BOOST_OK - Failed
build SPHINX as DLL (ha_sphinx.dll)
-- Looking for MFC
-- Looking for MFC - found
-- Cannot find wix 3, installer project will not be generated
-- Configuring done
-- Generating done
-- Build files have been written to: C:/mariadb-5.3/bld
I first compiled from within Visual Studio (alternate step #6), and here is the last line of that output:
========== Build: 84 succeeded, 1 failed, 2 up-to-date, 6 skipped ==========
(More on the 1 error below – but it’s safe to ignore.)
And here is the output from the command line compilation (since I did this second, there was not nearly the output, so I ‘ll post it all):
C:\mariadb-5.3\bld>cmake --build . --config relwithdebinfo --target package
Microsoft (R) Visual C++ Express Edition Version 9.0.30729.1.
Copyright (C) Microsoft Corp 2007. All rights reserved.
1>------ Build started: Project: PACKAGE, Configuration: RelWithDebInfo Win32 ------
1>Performing Post-Build Event...
1>CPack: Create package using ZIP
1>CPack: Install projects
1>CPack: - Install project: MySql
1>CPack: Create package
1>CPack: - package: C:/mariadb-5.3/bld/mariadb-5.3.3-win32.zip generated.
1>Build log was saved at "file://c:\mariadb-5.3\bld\PACKAGE.dir\RelWithDebInfo\BuildLog.htm"
1>PACKAGE - 0 error(s), 0 warning(s)
========== Build: 1 succeeded, 0 failed, 86 up-to-date, 0 skipped ==========
CMake – Cannot find source file “cmake_dummy.cc”:
Cannot find source file "cmake_dummy.cc"
Upgrading CMake from 2.6 (2.6.4) to 2.8 (2.8.7) worked and eliminated this error. You can download it from here.
CMake – General Comment:
If you have previously installed Visual Studio 2005 and now have installed Visual Studio 2008 (or 2008 and 2010, or some other mix), it is probably best to specify the Generator when invoking cmake. I was getting various strange errors when I did not specify the generator of the Visual Studio I use to compile. Specifically, my cmake was using the VS2005 generator, but I was building with VS2008. So, I had to perform a conversion when opening the solution in VS, not to mention some other starange issues were occurring (saying I passed MFC test, but I was using VS2008 Express, so I did not have the proper MFC for VS2008). Similarly, cmake using relwithdebinfo failed too.
Instead of using:
cmake .. -G "Visual Studio 9 2008"
If you’re not sure what string to use for -G, simply run “cmake” from the command line, with no arguments, and it will display the various available options. For instance:
cmake version 2.8.7
The following generators are available on this platform:
Visual Studio 10 = Generates Visual Studio 10 project files.
Visual Studio 11 = Generates Visual Studio 11 project files.
Visual Studio 8 2005 = Generates Visual Studio .NET 2005 project
Visual Studio 9 2008 = Generates Visual Studio 9 2008 project files.
Build – afxwin.h missing error – mysql_upgrade_wizard error:
VS2008 Build ..
11>Build log was saved at "file://c:\mariadb-5.3\bld\win\upgrade_wizard\
11>mysql_upgrade_wizard - 1 error(s), 0 warning(s)
c:\mariadb-5.3\win\upgrade_wizard\stdafx.h(23) : fatal error C1083:
Cannot open include file: 'afxwin.h': No such file or directory
Since this is just the mysql_upgrade_wizard, this can be ignored unless you specifically need this.
Otherwise, locate ‘afxwin.h’ and store it to the correct location.
Note that you’re likely receiving this if you using the Visual Studio Express Edition, as ‘afxwin.h’ is not available in the Express Edition, as described on the following pages:
Other common build errors and their solutions can be found here.