Compiling Mame

Compiling MAME is a real pain. Expect to spend a whole w/e on it. Here is my guide to compiling. I hope it saves someone a w/e.

If you are running on 7 then there is no need to compile for 32 bit. The 64 bit version of MAME runs faster. If you are stuck on XP then you will need to compile for 32 bit.

Why Compile?

  • It's fun!
  • It can be your plan for the w/e
  • You can disable those annoying messages that tell you to type OK
  • You can step thru SW Trilogy and find out why it's running so slow then curse b/c there's been no progress


    Do the following steps to compile MAME for Windows 7 64 bit:

  • Download the latest source code
  • Download the latest patches for the source code you downloaded above
  • Apply each patch in sequential order using the patch -p0 -E < diffname.diff command
  • Download the Windows SDK for Windows 7
  • Download the latest DirectX SDK
  • Download the MinGW 64 Compiler
  • Set your development environment to 64 bit mode:
    "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\utilities\bin\dx_setenv" amd64
    "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\setenv" /x64
  • Run the make command to compile the project

    My complete batch script is here:

    rd /s /q obj
    del /q vmamed.exe
    del /q mame.exe
    del /q mame64.exe
    rem **********************
    rem 64 bit compile
    rem **********************
    call "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\utilities\bin\dx_setenv" x64
    call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64
    SET SDKBASE=C:\Program Files\Microsoft SDKs\Windows\v7.1
    SET DXBASE=C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)
    set vsbase=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC
    SET PATH=%path%;%SDKBASE%\Bin;c:\MinGW64\bin;   
    SET INCLUDE=%SDKBASE%\Include;%DXBASE%\Include;%vsbase%\include;
    SET LIB=%SDKBASE%\Lib;%dxbase%\lib\x64;%vsbase%\lib;
    rem make -j7 MSVC_BUILD=1 DEBUG=1 SYMBOLS=1 PTR64=1
    make -j7 PTR64=1

    The -j7 means that I have an Intel i7 so I can run seven jobs at a time which greatly increases compile speed.

    Problems (some may be 32 bit related)

    Error Solution
    'mingw32-make' is not recognized as an internal or external command mingw32-make is for compiling for 32 bit version only. You need the 64 bit version of MinGW. Instead of mingw32-make, use make. If you are trying to compile for 32 bit then this error means you have the wrong version of ming. Try the one from Source Forge
    src/osd/windows/vconv.c(43) : fatal error C1034: windows.h: no include path set Add Visual Studio lib path to lib environment variable
    LINK : fatal error LNK1181: cannot open input file 'dxguid.lib' Install DirectX SDK, add DirectX SDK lib path to lib environment variable
    LINK : fatal error LNK1181: cannot open input file 'unicows.lib' Download Windows SDK for Windows 7, add Windows SDK to lib environment variable
    LINK : fatal error LNK1181: cannot open input file 'dinput.lib' Download dx70_min and update the lib environment variable to include it
    The program can't start because libintl-8.dll is missing from your computer. You need to add c:\mingw\bin (or wherever you put ming) to your path.
    LINK : fatal error LNK1104: cannot open file 'LIBCMTD.lib' Update lib environment variable to include Visual Studio lib path
    cannot open output file obj/windows/vmamed/build/vconv.exe: Permission denied Exit the shell and manually delete the obj folder in mame using Windoz explorer. Run again
    fatal error C1083: Cannot open include file: 'd3d8.h': No such file or directory Add the DirectX SDK\include path to the include environment variable
    error C3861: 'InterlockedCompareExchange64': identifier not found Include the 64 bit version of MinGW to the path environment variable and put it before ming32 or ming.

    7467 people have had a problem compiling MAME since 3/11.