Home Page
Posted By: MAMEBase Compiling SDLMAME (Mac OS X) for Dummies - 10/03/08 05:21 PM
I've taken the liberty of writing up a small, step-by-step 'How to' for compiling SDLMAME on OS X,

It's a little longer than the directions included with the source, but I believe it to be a little easier to follow for the novice.

Feel free to use it, use parts of it, rewrite it, or ignore it completely as you see fit.

=====

Compiling SDLMAME for mac OS X for Dummies

So you've decided to compile your own copy of SDLMAME.

Follow these simple steps, and you'll be up and running in fairly short order.

Preliminary Steps (These need be done only once, with the occasional periodic updates) -

- Run Software Update -
Your Operating System, and supporting files should be updated prior to compiling SDLMAME (and should be kept up to date regardless) The minimum supported OS for SDLMAME under Mac OS X is 10.4.x (Tiger).

- Install Xcode
Xcode is a free developer environment from Apple, and although it will be used to compile SDLMAME, you will not be required to learn how to run it.
It will need to be installed prior to compiling SDLMAME. As of this writing (10/08) the current version of Xcode is 3.x (for Mac OS X 10.5.x (Leopard)), The minimum supported version of Xcode is 2.3.
Xcode is free from Apple, either as part of your original install discs (or retail copy of OS X) or as a free download from http://developer.apple.com/

- Install SDL
Simple DirectMedia Layer (SDL) is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer. It is used by MPEG playback software, emulators, and many popular games, including the award winning Linux port of "Civilization: Call To Power."
Go to http://www.libsdl.org/ , and click the "SDL 1.2" download link in the sidebar, then scroll down to "Mac OS X" under "Runtime Libraries". Download the "SDL-1.2.13.dmg" disk image and open it.
Click 'Macintosh HD' (or whatever your Mac's hard disk is named) in the left pane of a Finder window, then open the Library folder and drag the SDL.framework folder from the SDL disk image into the 'Frameworks' folder.

You have Xcode, and SDL installed?

Great! Let's move on to the next step!

Download and unzip the latest version of SDLMAME.
Place the resulting folder in your 'Applications' folder, or wherever you want SDLMAME to live.

Open the Terminal (Applications->Utilities->Terminal).

In the Terminal window, type cd, and a space, drag the SDLMAME folder you just unzipped into the Terminal window, and hit return.

This changes the directory path to the SDLMAME folder.

Now we're about to begin the compiling process.

If you are compiling on an Intel based Mac, copy this line, and paste it into the terminal -
make TARGETOS=macosx

If you are compiling on a PowerPC Mac, copy this line, and paste it into the terminal -
make TARGETOS=macosx BIGENDIAN=1

In either case, hit return, and go have a sandwich, as this will take a little while.

Now, let's recap (The short version) -

- Update OS X via Software Update

- Install Xcode, and SDL (only needs to be done once)

- Unzip, and place your SDLMAME folder

- Open the Terminal, navigate to the SDLMAME folder, and type or copy the following -

make TARGETOS=macosx
(Intel Macs)

-or-

make TARGETOS=macosx BIGENDIAN=1
(PPC Macs)

Hit Return

That's it! You've just compiled SDLMAME!
since most of the recent macs are dual core, I'd suggest to use

Code:
make -j3 TARGETOS=macosx
(Back from the murky depths of the abyss he crawls...)

Thanks for the expanded instructions Dave, this was a huge help! I haven't played MAME in years, and I was able to get SDLMAME to compile and run using MacMAMEInfoX with minimal fuss.

Ahhh... memories.

Question - is "make -j3 for dual-core and -j5 for quad-core to build MAME at speeds never before achieved" (from the SDLMAME.txt) strictly to increase build speed, or is that to also optimize MAME for running on a multi-core processor? At any rate, it certainly built quickly on my quad-core Mac Pro.

And yes, I still have your laserdiscs. eek Terribly sorry I haven't sent them back to you. I was planning on digitizing them (yet again) and sending you the digital files along with the laserdiscs, but was waiting until I got an AJA Kona LSe card so I could do them in ProRes 422. However, now I see that there's already a digitizing project well under way (I hope they're remembering to remove the 3:2 pulldown from CAV 23.98 fps discs), so I'm guessing that probably isn't necessary. Although I will have the card this summer, since it's part of our archiving project at work (I may even be able to swing one of these if I'm lucky)... so if you do want them digitized... wink

Anyway, fire me off an e-mail (still the same address), and I promise I'll get the LDs sent back to you.

(Really... I am sorry about that.)
The -j3/-j5 is for building only. However, MAME also does use multiple cores for some games (primarily 3D ones). It automatically detects the number of cores at runtime, there's no need to do anything special.

Laserdiscs are being captured in a special way to preserve all the data exactly as it is (and yes, that means video-sourced ones like Firefox look awful in MAME right now due to the lack of a deinterlacer). It requires a Windows machine with a specific ATI capture card and custom software that Aaron wrote.
One other quick question - once it's done building, what can I throw away from the folder? (Or more to the point - what do I have to keep?) Thanks!
Once it's built you can safely wipe out the obj and src folders (which is pretty much everything).
Thanks - much appreciated!
Nathan?

Nathan!

Welcome back, and welcome to SDLMAME!

I'm glad that my compiling instructions were useful, gladder that my LaserDiscs didn't get lost in transit (something I was a bit worried about), and gladdest of all that you haven't fallen off the face of the Earth (I fell off of the Earth's face once... Landed in the Earth's lap... Fortunately, I was able to climb back up before the Earth stood up...)
Guess who else is back smile It's been so long that I think the last time I logged in was right after Richard lost the DB and he needed to re-create the accounts smile Anyway, for those of you who actually remember me, hi!

Anything happen in sdlmame in the past few years? Do I need to set a compile-time flag for cheats now (it doesn't seem to appear in the menus when -cheat is flagged)? Do we have new optimal make settings for OS X Intel, or just make -j3 TARGETOS=macosx still?
You need a cheat.dat from late 2008 or newer (cheat.retrogames.com has the latest). Old ones don't work.
Thanks smile
Has anyone compiled 7zip capabilities into sdlmame yet? If not, I might take a crack at it....
We don't need your damn 7zip and its MFC crud. If you want 7zip, I suggest you make your own emulator, with blackjack and hookers.
Posted By: Sune Re: Compiling SDLMAME (Mac OS X) for Dummies - 10/02/09 05:39 AM
Originally Posted By Em Adespoton
Do we have new optimal make settings for OS X Intel, or just make -j3 TARGETOS=macosx still?


The kick in the left nut for OS X SDLMAME users is that you can't compile a 64-bit binary because there is no 64-bit SDL library. The kick in the right nut is that multithreading isn't working and so you can't offload the final blit to the video card like you can on Windows. Well actually it works, it just keeps spitting out 'just leaking' errors in the logs.

Try both of these and see which one is fastest. Should be just a couple FPS though, if any.

make -j3 TARGETOS=macosx ARCHOPTS=-march=nocona
make -j3 TARGETOS=macosx ARCHOPTS="-march=pentium-m -msse3"

I saw a discussion somewhere about using the nocona switch on Core-architecture CPUs, some guy was arguing for it but that's all I remember.
It's a bad idea to use nocona for core series. It enables some features, but completely screws up the pipeline scheduling. OSX enables SSE2 by default, anyway.
Posted By: judge Re: Compiling SDLMAME (Mac OS X) for Dummies - 10/02/09 08:21 AM
This is only for 10.6, though. On 10.5 things are still ok.

Btw, I simply added a -m32 to the LDFLAGS and that did the trick for me on 10.6.
Vas: the ANSI C implementation in the LZMA SDK works without MFC emulation, but it also can't open all .7z files *facepalm*. Regardless, the code is generally a bit awful and disk space is extremely cheap so we see no need for 7zip support.
Thanks for the explanation Richard smile

I'm slowly getting my MAME test environment set back up. Did the format for artwork change at some point? My custom overlays don't seem to work anymore either....

What with MAME changes, redumps, format changes, SDL changes and OS changes, this isn't really the same MAME we had in 2004....
Yes, artwork is composited by the graphics card now, generally from scans of 3000 DPI or better (so e.g. Space Invaders full-screen on a modern flat panel looks *really* nice). That of course required a new format.

ETA: I should point out that the new artwork comes officially from Mr. Do's page. You can also get replacement fonts there for MAME's on-screen display to customize it however you'd like.
Posted By: CRP Re: Compiling SDLMAME (Mac OS X) for Dummies - 11/23/09 10:11 AM
Hi, is a 64-bit build of SDLMAME for OS X still a no go?
It works to some extent, but it's unsupported, so if it breaks, you get to fix it yourself.
Posted By: Sune Re: Compiling SDLMAME (Mac OS X) for Dummies - 11/23/09 03:24 PM
FWIW 64-bit builds of both SDLMAME and SDLMESS work well for me on Snow Leopard.

Don't forget you have to compile a 64-bit SDL framework as well, but it's easy, just download the SDL source code and follow the instructions in the OS X readme.

Posted By: Sune Re: Compiling SDLMAME (Mac OS X) for Dummies - 11/23/09 03:26 PM
*delete*

double post.. had a power outage. I love Brazil.

SDL 1.2.14 (which is out now) supposedly comes with 3-way universal libs (PPC, x86, x64), which should make it easier.
Posted By: CRP Re: Compiling SDLMAME (Mac OS X) for Dummies - 11/23/09 09:22 PM
Just compiled with PTR64=1 on Snow Leopard and works fine, no issue so far. Compiling SDL was not necessary using 1.2.14 as per R.Belmont above. Did not notice an appreciable speed gain, though further tests will follow.
Posted By: Sune Re: Compiling SDLMAME (Mac OS X) for Dummies - 11/25/09 01:21 AM
Compare Prop Cycle on 32- and 64-bit builds. You should see a good 20% difference.
Originally Posted By CRP
Just compiled with PTR64=1 on Snow Leopard...


"make -j3 TARGETOS=macosx PTR64=1"
This is the command for dual-core 64-bit on Snow??
Yes, with SDL 1.2.14. That is not yet a supported configuration however so if it breaks stick to 32-bit.
Posted By: andy18 Re: Compiling SDLMAME (Mac OS X) for Dummies - 12/02/09 07:48 AM
I just installed the latest x code for my 10.4 system, when I go into terminal to type cd and drop the sdlmame folder into it i get this:fork: Resource temporarily unavailable.

I'm unable to do anything else from there, what am i doing wrong?
That's weird - it means there's something internally very wrong with OS X. Try rebooting?
You might also try a permissions repair via Disk Utility (it couldn't hurt...)

Can you tell us a bit about your System configuration (Processor, RAM, System version)?
Posted By: andy18 Re: Compiling SDLMAME (Mac OS X) for Dummies - 12/03/09 04:26 AM
Imac with Intel core duo 2 Ghz
2 GB of Ram
10.4.11

Latested X code i can get is 2.4.1
Posted By: andy18 Re: Compiling SDLMAME (Mac OS X) for Dummies - 12/03/09 04:43 AM
A lost did a permission and disc verify and everything is alright.
Assuming you've rebooted by now, does the problem persist?
I assume "everything is alright" means it didn't? smile
Posted By: andy18 Re: Compiling SDLMAME (Mac OS X) for Dummies - 12/03/09 07:06 AM
Originally Posted By R. Belmont
I assume "everything is alright" means it didn't? smile


LOL yea even after a reboot I did the CD and space, dropped the sdlmame folder in the terminal window and it still tells me the same thing. I didn't have xcode before so i just downloaded the last update for my system, which seems like the entire program. Do you think that has something to do with it?

Maybe preferences are different on my terminal compared to others?
I think your next troubleshooting step will be to create a new admin level user account, log into it, and try again.

If this works, it means that the problem is somewhere in your existing user account (likely a preference issue). If the problem persists, you may need to reinstall the OS (do an Archive and install to preserve your existing user account and data).

You may also want to consider updating to Snow Leopard (10.6x).
Another thought -

Check the individual permissions for both the Terminal App, and the SDLMAME folder (select an item, and go to 'Get Info' under the 'File' Menu). What does it say under the 'Sharing and Permissions' section of the info window for each item?

Also, stupid question - You are logged in as an Admin User, are you not?
Wait, "dropped the sdlmame folder in the terminal window"? Is that intended to do something useful?
Posted By: CRP Re: Compiling SDLMAME (Mac OS X) for Dummies - 12/03/09 03:08 PM
iirc that types out the path at the terminal prompt
Ahh, ok. That's pretty cool.
That's correct.

When I compile SDLMAME, I open the terminal, type 'cd ', drag the newly unzipped SDLMAME folder to the terminal window, and hit return.

This sets the path for the target without my having to worry about my lack of accurate typing ability... smile

I then copy the 'make' command from the 'SDLMAME,txt' document, paste it into the terminal, hit return, and go have a sandwich... smile

The fact that andy18 is unable to set his path in the Terminal in this manor is a bit puzzling, to say the least...
Posted By: andy18 Re: Compiling SDLMAME (Mac OS X) for Dummies - 12/04/09 05:20 AM
Originally Posted By MAMEBase
Another thought -

Check the individual permissions for both the Terminal App, and the SDLMAME folder (select an item, and go to 'Get Info' under the 'File' Menu). What does it say under the 'Sharing and Permissions' section of the info window for each item?

Also, stupid question - You are logged in as an Admin User, are you not?


I really appreciate the help, i checked the permissions and they are set on read and write for both item, and I have only one account which is the main administrator account.

Okay. let's backtrack a bit.

Create an empty folder on your desktop, open the Terminal, type "cd " (without the quotes) and drag the newly created folder to the terminal window, and hit return.

What is the result?

Now try setting the path to the SDLMAME folder (open a new terminal window, type 'cd ' drag the SDLMAME folder to the terminal window, and hit return)

if you're getting an error in either case, please select the contents of the terminal window, copy the text, and paste it in your response.
Posted By: andy18 Re: Compiling SDLMAME (Mac OS X) for Dummies - 12/04/09 07:06 PM
Heres the blank folder:
Andy$ CD/Users/Andy/Desktop/untitled\ folder/
-bash: CD/Users/Andy/Desktop/untitled folder/: No such file or directory

SDL Folder:
Andy$ CD/Applications/sdlmame0135u2-x86_64/
-bash: CD/Applications/sdlmame0135u2-x86_64/: No such file or directory

Note it says this message when I don't put a space after the CD, if i do it gives me the original error:
CD /Applications/sdlmame0135u2-x86_64/
/usr/bin/CD: fork: Resource temporarily unavailable
Try it with "cd" lowercase.
and also with a space after "cd"
Okay, I think we're closing in on the problem...

When I first posted this thread, I discovered long after the fact that there was a typo in the first post where 'cd' should have been lowercase. (I didn't realize at the time that commands in the terminal were case sensitive.)

Unfortunately, for whatever reason, I can no longer edit that first post... frown

Try this -

Open the Terminal

Type 'cd' and a space (that's cd ), drag the SDLMAME folder to the terminal window, and hit return.

Follow the remainder of the provided instructions, and you should be on your way...

@R.Belmont -

I'm looking to revise these instructions (in a new thread) to include updated information about current versions of XCode and SDL.

Mention has been made about additional build options (primarily for Intel Macs... I'm still about 2-3 moths away from retiring my G5 Tower, and replacing it with a 27" iMac... grin ). Would you (or someone) mind listing these build options here so I might include them in my revised instructions?
I fixed your post smile
Posted By: andy18 Re: Compiling SDLMAME (Mac OS X) for Dummies - 12/05/09 07:49 AM
Wow thanks a lot you guys, the path has been corrected and amazing what lower case can do. Thanks for the patience and wanting to help!
Originally Posted By R. Belmont
I fixed your post smile


Ah! So you did!

Thank you!
Posted By: andy18 Re: Compiling SDLMAME (Mac OS X) for Dummies - 12/05/09 07:54 PM
Got one more problem, i try compiling it and it says

/Applications/sdlmame0135u2-x86_64 Andy$ make TARGETOS=macosx
make: *** No targets specified and no makefile found. Stop.
Uhh, and that folder does contain the SDLMAME source?
Oh, for crying out pete's sake...

Go here, and get the source.

Unzip the file, and build using the resulting SDLMAME folder.

And before you ask, you'll want to get a front end to use with SDLMAME, since SDLMAME is a command line application. I'd suggest MAME_Tunes

If you still need help getting that set up, please start a new thread.
Posted By: andy18 Re: Compiling SDLMAME (Mac OS X) for Dummies - 12/06/09 08:48 PM
Thanks MAMEbase it compiled finally, I don't understand what was wrong with the SDL folder i downloaded before but the link you gave me actually worked.
If I were to hazard a guess, I'd say based on one of your previous posts, it looks like you may have originally downloaded a pre-compiled, 64-Bit version of SDLMAME (which probably wouldn't have worked with your setup, as I believe the 64-Bit version a) is not yet officially supported, and b) would require Mac OS X 10.6x to run).

Keep an eye on this forum, as R.Belmont makes a general announcement (with a link to the appropriate page) when a new version of SDLMAME becomes available.
© Forums