Building MariaDB on Windows
The Windows build in MariaDB 5.2 and later is compatible with MySQL5.5, so you can use description on MySQL CMake Wiki. Also, a detailed step-by-step description Visual Studio Express users is available here. Description here is therefore more compact.
Build Requirements
To build MariaDB you need this set of software:
- Visual C++: At the moment of writing we support Visual Studio 2008 and 2010, including express editions (generally we try to support the latest version and prior). Install latest service packs as well, which are at the moment of writing SP1 for both VS2008 and VS2010.
- Bazaar: Required to build from source tree. Use standalone installer and choose default install options.
- CMake 2.8 Build system.
- Bison from GnuWin32: Creates parts of the SQL parser. Choose "Complete package except sources". NOTE: Do not install this into default path with spaces, the build will beak due to this bison bug. Instead, install into C:\GnuWin32 instead. Add C:\GnuWin32\bin to system PATH after installation.
- Strawberry perl. Used to run the test suite. ActiveState Perl is another Win32 Perl distribution and should work as well (but it is less used).
- Optionally: Only if you intend to build MSI packages, install Windows Installer XML version 3.0 or higher
Verify that bison.exe, bzr.exe, cmake.exe and perl.exe can be found in PATH environment variable, with "where bison
", "where bzr
" etc from the command line prompt.
Building Windows binaries.
The above instructions assume MariaDB 5.2 or higher. For instructions how to build 5.1, look in the section "Old Style Build".
Branch bzr repository, or unpack the source archive. In the command prompt, switch to source directory. Execute
mkdir bld cd bld cmake .. cmake --build . --config Relwithdebinfo
The above example builds release 32 bit configuration, in subdirectory named bld. "cmake .." is the configuration step, "cmake --build . --config Relwithdebinfo" is the build step.
Variations:
- Building Debug version is done with
cmake --build . --config Debug
- x64 Build. By default, cmake will create 32 bit projects. For 64 bit, you must pass CMake "generator" parameter using -G in the configuration step,e.g
cmake .. -G "Visual Studio 10 Win64"
for VS2010 or
cmake .. -G "Visual Studio 9 2008 Win64"
for VS2008. For complete list of available generators, call "cmake" without parameters.
- IDE build. Instead of calling "cmake --build" as above, open MySQL.sln. When Visual Studio starts, choose Build/Compile.
- NMake builds. Ensure the Visual Studio environment variable are correctly set, e.g build from "Visual Studio 2010 Command prompt" (Start=>All Programs=>Microsoft Visual Studio 2010=>Visual Studio tools=>Visual Studio Commad Prompt (2010)). It can be convenient to create a shortcut from to "Visual Studio Command Prompt(2010) on the desktop (nativagte in start menu to find it, then rightclick=>Send To=>Desktop (create shortcut)" On the command line, execute
mkdir bld cd bld cmake .. -G "NMake Makefiles" nmake
You can optionally pass -DCMAKE_BUILD_TYPE={Debug|RelWithDebInfo} to cmake to build either debug or release.
- devenv builds. Ensure the Visual Studio environment variable are correctly set (see above). to build, execute
devenv mysql.sln /build relwithdebinfo
or, for debug builds
devenv mysql.sln /build debug
Optional build parameters
MySQL CMake Wiki describes how to use optional parameters in build. Perhaps single important parameter in MariaDB is WITH_EMBEDDED_SERVER (build with embedded server). It is not set by default in build, since it effectively doubles the compilation time.
Use cmake -DWITH_EMBEDDED_SERVER=1
to enable embedded.
Building ZIP package
cmake --build . --config relwithdebinfo --target package
Building MSI package
This is slightly different between VS2010 and VS2008 (target names are different)
- VS2010: cmake --build . --config relwithdebinfo --target win/packaging/msi
- VS2008: cmake --build . -- config relwithdebinfo --target msi
Code signing support for MariaDB release processing
MariaDB builds optionally support authenticode code signing with and optional parameter SIGNCODE. Use cmake -DSIGNCODE=1
during configuration step to sign the binaries in ZIP and MSI packages. Important: for SIGNCODE=1 to work, user who runs build need to install valid authenticode digital certificate into his certificate store, otherwise the packaging step will fail.
Building packages for MariaDB release
Traditionally, since MySQL release package has been a mix of debug and optimized builds (that included debug version of static libraries plus mysqld-debug.exe) MariaDB packages also can be build as mix of release and debug builds.
The full script to create the release in out-of-source build with Visual Studio 2010 with signed binaries might look like
mkdir bld cd bld cmake .. -DWITH_EMBEDDED_SERVER=1 -DSIGNCODE=1 cmake --build . --config debug cmake --build . --config relwithdebinfo --target package cmake --build . --config relwithdebinfo --target win/packaging/msi
Old-style building (MariaDB 5.1)
The difference between legacy build MariaDB 5.1 vs later versions is that
- 5.1 cannot be built out-of-source.
- 5.1 requires additional step (win\configure-mariadb.bat) during configuration.
- 5.1 requires prepackaged source distribution (made on Unix only) to create ZIP package. It also requires Cygwin to create the ZIP
- 5.1 does not feature MSI installer, instead NSIS is used. Building NSIS also requires pre-packaged source distribution and cannot be made from bzr repository.
win\configure-mariadb.bat cmake . cmake . --build relwithdebinfo
ZIP packaging in 5.1
The process for producing 5.1 binary zip is as follows:
- Make the source tarball. This can only be done on Unix (we use Linux) by running
BUILD/compile-dist && make dist
. See Creating the MariaDB Source Tarball for full instructions.- In BuildBot, this is done by hardy-amd64-makedist builder.
- Compile and package on Windows. This is done by unpacking the source tarball on Windows and running
sh win/make_mariadb_win_dist
.- In Buildbot, this done by win32-make-noinstall-zip builder.
NSIS installer in 5.1
If you want to create the release, you also need NSIS.
Build the server as usual. You should build the release, not debug or any other. When the server has been built, simply run "cpack
" in the top directory.
Miscellaneous
- In 5.2 and later, Cygwin is not required for any build step and not supported. Don't use it, if you can.