Thursday, December 16, 2010

How to compile mame in Ubuntu 10.04 Lucid Lynx

UPDATE: A newer guide is available at Compiling Mame on Ubuntu 14.04 Trusty Tahr.

Using the following instructions you should be able to compile Mame on Ubuntu 10.04 Lucid Lynx, though it should also work in most any other version of Ubuntu too.
  1. Download the latest source from http://mamedev.org/release.html Grab the .zip version. The following command will grab the latest source as of the time I wrote this tutorial.
    wget http://mamedev.org/downloader.php?file=releases/mame0140s.zip --user-agent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" -O mame_source.zip
    Here we change the user/agent string, because the server is set to prevent robots, like wget, from programmatically downloading the file.
  2. Unzip the file, and then unzip that file. Place it anywhere you like, perhaps your home directory.
    mkdir mame
    unzip mame_source.zip
    unzip mame.zip -d mame
    rm mame.zip
  3. Next we install all the libraries and dependencies necessary to build mame.
    sudo aptitude install build-essential libgtk2.0-dev libgnome2-dev libsdl1.2-dev
  4. Finally, lets get to building it.
    cd mame
    make
  5. Let's setup a rom folder and get some roms.
    mkdir roms
    cd roms
    wget http://mamedev.org/roms/sidetrac/sidetrac.zip --user-agent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"
  6. Now that we have legally obtained an arcade ROM, let's play it!
    cd ..

Once you know what libraries to install, compiling Mame from source is quite easy in Ubuntu. Drop me a line in the comments if this is helpful, or if you run into any problems or have any suggestions.

6 comments:

  1. In the first step, replace the last word "mame.zip" to "mame_source.zip".

    ReplyDelete
  2. How do you know what libraries are needed to compile mame? Do they list them for each version on their website? Or are these libraries that the current version of Ubuntu needs to compile any executable?

    ReplyDelete
  3. @dusts:
    Well, that's the hard part of compiling things from source, finding the required libraries.
    To find the required libraries, I downloaded the source and then tried to compile. When I ran into an error I googled the error and found where someone has had that error and needed a certain library. I repeated this process until I had found and installed each library and the compile was successful. It is a frustrating process for me, and that's why I posted these instructions, in the hope that someone else trying to do the same thing will find them and be saved from the frustration.
    Whenever I run this process, I install Ubuntu in a VM to try the compile, because I often end up installing all sorts of unnecessary libraries before I get the right ones, and if I do that on my real workstation, I end up with a bunch of unnecessary stuff on my machine.
    After I completed this install I created yet another virtual machine to test that my instructions where correct.

    ReplyDelete
  4. libgnome2-dev: command not found

    what does it all mean basil?!

    ReplyDelete
  5. Execute the commands exactly as I listed. If you just type `libgnome2-dev` in a terminal that is indeed the error you should receive. However, if you run the whole line together as I have posted it should work with no problem.

    ReplyDelete
  6. src/osd/sdl/sdl.mak:517: *** target pattern contains no `%'. Stop.

    $TARGET and $SUBTARGET are both set as mame.

    What's up with the makefile setups of the newer MAME releases? Am I missing something obvious and easy here?

    Just going into debugging this one: would anyone have a quick pointer on this one?

    ReplyDelete