Compiling MAME on Raspberry Pi 3

With the release of Raspbian Stretch we are finally up to date with the software that MAMEdev use to build MAME, all the kludges we used to have to do to get MAME to build are done away with…

…and a new one has arrived :/

We no longer need to build GCC6 so I’ve done away with that tutorial, but we do still need to install a custom version of SDL2. Now we need v 2.0.6 as a minimum and we need to edit it a little before we build. This will speed up the performance of MAME by about ⅓ so it’s worth the effort.

OK so, without further ado, here is the new tutorial for the Stretch friendly build of MAME

For this tutorial I am starting with a fresh install of Raspbian Stretch.

After first boot, do all the standard stuff:

  • Set Wi-Fi
  • Set Hostname
  • Set Password
  • Set Boot to CLI
  • Set memory split to 16
  • Set Locale, Time Zone, Keyboard, Wi-Fi Country
  • sudo apt-get update
  • sudo apt-get upgrade
  • Reboot

Then, because I’m a Mac user I sudo apt-get install netatalk so I can see the Pi on my network and get to the home folder.

Next we need to install SDL2-2.0.6. Follow the tutorial for that and I’ll meet you back here.

Install SDL2-2.0.6

Welcome back! We’re almost ready, If you are downloading my MAME builds, this is as far as you need to go, just download the latest build unzip it and skip to the end of this tutorial. 

Next we will need a larger swapfile.

sudo nano /etc/dphys-swapfile

Find the line that says CONF_SWAPSIZE=100 and change the value so that it reads
CONF_SWAPSIZE=2048

Save, exit & reboot.

OK now we can get on with the MAME… *phew!*

Let’s put it all somewhere sensible.

cd
mkdir code
cd code
mkdir mame

Download and unzip

wget https://github.com/mamedev/mame/releases/download/mame0189/mame0189s.zip 
unzip mame0189s.zip -d mame
cd mame
unzip mame.zip
make -j5

…and wait, and wait, and wait some more. Eventually it should finish.

Don’t forget to turn the swap file back to 100mb.

sudo nano /etc/dphys-swapfile

Find the line that says CONF_SWAPSIZE=2048 and change the value so that it reads
CONF_SWAPSIZE=100. Save and exit, then adjust the memory split to something more sensible for running MAME, so run sudo raspi-config and set the memory split to 256.

Reboot.

Once we’re back up we can run MAME. The first thing we need is a set of default mame options.

cd code/mame
./mame -cc
mkdir roms

That created the default mame.ini file and added a roms folder where MAME can see it by default. Put your MAME roms in the newly created roms folder and test run

./mame gridlee