Building MariaDB on Windows

You are viewing an old version of this article. View the current version here.

Build requirements

To build MariaDB you need the following:

  • Visual C++: We currently support Visual Studio 15/17 (generally we try to support the two most recent versions). Community editions will work fine; we only use them in our builds. While installing Visual Studio, make sure to add "Desktop Development with C++".
  • CMake: We recommend the latest release. Older releases might not support your version of Visual Studio.
  • Git: Required to build newer versions from the source tree.
    • NOTE: run
git config --global core.autocrlf input

after the installation, otherwise some mtr tests will fail

In the "Adjusting your PATH" dialog, choose "Use Git from Windows command prompt", otherwise wrong (mingw64) git and perl will be in your PATH

  • Bison from GnuWin32: Bison creates parts of the SQL parser. Choose "Complete package except sources" when downloading.
    • NOTE: Do not install this into your default path with spaces (e.g. under C:\Program Files\GnuWin32); the build will break due to this bison bug. Instead, install into C:\GnuWin32.
    • Add C:\GnuWin32\bin to your 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 not as well tested).
  • Optional: If you intend to build the MSI packages, install Windows Installer XML version 3.9 or higher
  • Gnu Diff, needed if you run mysql-test-run.pl tests.

Verify that bison.exe, bzr.exe or git.exe, cmake.exe and perl.exe can be found in the PATH environment variable with "where bison", "where git", "where perl" etc. from the command line prompt.

Building Windows binaries

The above instructions assume MariaDB 5.5 or higher.

Branch the MariaDB bzr repository, or unpack the source archive. On the command prompt, switch to your source directory, then execute:

mkdir bld
cd bld
cmake ..
cmake --build . --config RelWithDebInfo

The above example builds a release configured for 32 bit systems in a subdirectory named bld. "cmake ..." is the configuration step, "cmake --build . --config Relwithdebinfo" is the build step.

Build variations

Debug builds

Building Debug version is done with:

cmake --build . --config Debug

x64 builds

By default, cmake will create 32 bit projects. For 64 bit, you must pass CMake the "generator" parameter using -G in the configuration step, e.g.:

cmake .. -G "Visual Studio 15 2017 Win64"

for VS2017 or

cmake .. -G "Visual Studio 14 2015 Win64"

for VS2015.

For a complete list of available generators, call "cmake" without any parameters.

IDE builds

Instead of calling "cmake --build" as above, open MySQL.sln. When Visual Studio starts, choose Build/Compile.

NMake builds

Ensure the Visual Studio environment variables are correctly set, e.g. build from "Visual Studio Command prompt" .It can be convenient to create a shortcut to "Visual Studio Command" on the desktop (navigate 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.

Building the ZIP package

cmake --build . --config relwithdebinfo --target package

Building the MSI package

cmake --build . --config relwithdebinfo --target MSI

Including HeidiSQL in the MSI installer

Starting with MariaDB 5.2.7, it is possible to build an installer which includes 3rd party products, as described in MWL#200. Currently only HeidiSQL support is implemented; it is also included in the official builds. Use the CMake parameter -DWITH_THIRD_PARTY=HeidiSQL to include it in the installer.

Code signing support for MariaDB release processing

MariaDB builds optionally support authenticode code signing with an optional parameter SIGNCODE. Use cmake -DSIGNCODE=1 during the configuration step to sign the binaries in the ZIP and MSI packages.

Important: for SIGNCODE=1 to work, the user that runs the build needs to install a valid authenticode digital certificate into their certificate store, otherwise the packaging step will fail.

Building packages for MariaDB releases

The full script to create the release in an out-of-source build with Visual Studio 2010 with signed binaries might look like:

mkdir bld
cd bld
cmake .. -DSIGNCODE=1 -DWITH_THIRD_PARTY=HeidiSQL
cmake --build . --config relwithdebinfo --target package
cmake --build . --config relwithdebinfo  --target MSI

This command sequence will produce a ZIP package (e.g mariadb-5.2.6-win32.zip) and MSI package (e.g mariadb-5.2.6-win32.msi) in the bld directory.

Miscellaneous

  • In 5.2 and later, Cygwin is not required for any build step and is not supported. Don't use it if possible.
  • To compile the OQGRAPH engine, Boost needed to be installed. Download the Boost redistribution from http://www.boost.org/ and unpack it. Set the environment variable BOOST_ROOT to point to the directory where you unpacked boost in the previous step. For more details, see Building OQGraph Under Windows.

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.