The standard environment for building MAME on Windows consists of:
You can create a suitable environment by installing MSYS2, and then installing the necessary additional packages using the pacman package manager command.
Our main source code repository is hosted on GitHub (https://github.com/mamedev/mame.git), so you’ll need to check out a copy. Various optional features are disabled by default, but can be by passing additional arguments to the make command. Optional features may require additional MSYS2 packages to be installed. For more information on compiling MAME, see the relevant page on our documentation site.
First, download a copy of the MSYS2 environment from their web site and install it. Note that the MSYS2 environment requires a 64-bit edition of Windows 10 1809 or later for x86 or ARM. After installing the MSYS2 environment, open one of the MSYS2 shells so you can start installing packages.
You will always need to install Git, GNU Make, and the diff/patch utilities:
pacman -S git make diffutils patchThe additional packages you will need depend on the environment you will be using to build MAME. If you’re using an x86 system, you can use the UCRT64 environment. This gives you a choice of the GCC and clang compilers. You can also use the CLANG64 environment, although this limits you to using the clang compiler, and some additional tools may not be available. If you’re using an ARM system, you should use the CLANGARM64 environment.
If you’re using the UCRT64 environment, you should install Python and the LLVM tools used for archiving static libraries and linking:
pacman -S mingw-w64-ucrt-x86_64-{python,libc++,llvm,llvm-tools,lld}If you’ll be building with the GCC compiler, install it as well:
pacman -S mingw-w64-ucrt-x86_64-gccIf you’ll be building with the clang compiler, install it as well:
pacman -S mingw-w64-ucrt-x86_64-clangIf you’re using the CLANG64 environment, you should install Python, the LLVM tools used for archiving static libraries and linking, clang, and the GCC compatibility wrapper:
pacman -S mingw-w64-clang-x86_64-{python,libc++,llvm,llvm-tools,lld,clang,gcc-compat}If you’re using the CLANGARM64 environment, you should install Python, the LLVM tools used for archiving static libraries and linking, clang, and the GCC compatibility wrapper:
pacman -S mingw-w64-clang-aarch64-{python,libc++,llvm,llvm-tools,lld,clang,gcc-compat}After installing the required packages, an important thing is to set up Git first:
git config --global core.autocrlf trueAnd if you are contributor:
git config --global user.email youremail@something.com
git config --global user.name "Firstname Lastname"Then, to download the MAME source inside your MSYS2 home directory:
git clone https://github.com/mamedev/mame.gitAlternatively, locate your existing source tree (drives are mapped to hidden directories /c etc. under the virtual root):
cd /c/Projects/mameAnd finally to build, if you’re using the GCC compiler:
makeOr if you’re using the clang compiler:
make OVERRIDE_CC=clang OVERRIDE_CXX=clang++Similar to package managers on Linux like apt-get, yum etc. MSYS2 can automatically update packages for fixes, security updates etc. To update all installed packages to current, run the following command from an MSYS2 shell:
pacman -Sy
pacman -S bash pacman msys2-runtime --neededNext, exit the shell and restart MSYS2.
Finally, once back at the shell, execute:
pacman -SuThe shell you should use depends on the environment you’re using to build MAME:
For more information about MSYS2, see MSYS2-Introduction.
See our compiling documentation for information on additional packages needed for optional features.