Compiling MAME on Raspberry Pi

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.

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 the latest SDL2. Follow the tutorial for that and I’ll meet you back here.

Install SDL2 from source

 

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

2 thoughts on “Compiling MAME on Raspberry Pi

  1. Thank you so much Steve,

    I followed exactly your instructions and it works like a charm with the 0189 sources. I really started with a clean RASPIAN image on a 3B Pi.

    But if I try to compile newer sources like 203, 205 or 206 the compilation process gets stuck without any error messages.

    Do I have to do some additional steps before compiling newer
    versions?

    Anyway – I am already happy to be able to compile the 0189 sources – thanks a lot!

    Regards
    Dirk

    1. .206 compiled clean by following these instructions for me just the other day. There were a few broken releases but they are back working again now.

Leave a Reply

Your email address will not be published. Required fields are marked *