Mame 64bit compile on RPI4b
-
Hi,
Does anyone have a good process/settings on how to compile a 64bit mame to run on a 64bit RPIos? Looking for mame 228 or 229 specifically, not the actual latest. I have been able to compile using 32bit, but 64bit keeps failing. Maybe swap? Or, anyone know how to cross compile a mame 64bit version on a linux host to run on a actual raspberry pi 4 64bit aarch? Cross compile would be amazing to also cut down on how long compiling takes. -
@retrolou are you using the build script within retropie? it worked for me on aarch64. please fill out https://retropie.org.uk/forum/topic/3/read-this-first and also include a build log.
-
@dankcushions yes, I'm kinda using the retropie script, but i wanted specific versions of mame vs the latest. so I have been using the same make flags. The biggest improvement was setting the swap to 8192 or more to be sure. At one point i saw compiling eating up about 7GB, without that no way mame64 compiles on Pi4b even with 4gb memory. Know anyone/or how to compile mame for a pi on a linux host instead of actually compiling mame itself on the pi? I'd love to figure out/know how to do that?
-
@retrolou you didn't fill out ll out https://retropie.org.uk/forum/topic/3/read-this-first or provide a build-log. although i am curious if it currently builds on aarch64 so am doing that now, but i will only be looking at the buildlog to investigate.
please also provide a copy of your edited script
-
@dankcushions it does compile. i'm basically just using this on aarch64.
i use wget to grab the source zip from mamedev, unzip it then
make -j3 NOWERROR=1 ARCHOPTS=-U_FORTIFY_SOURCE PYTHON_EXECUTABLE=python3GPU mom at 16gb also seems to have helped. I've done 228, 229 and 225 all that way, using the make above with aarch64 buster and swap at 8gb
-
@retrolou Don't use
-j3
, the memory build requirements for recent (post Feb ?) versions have increased considerably and compiling multiple files will - on certain files - exhaust the memory pretty fast. -
@mitu yeah i have been able with the 8gb swap, actually compile with j4. have you ever tried cross compiling?
-
@retrolou said in Mame 64bit compile on RPI4b:
have you ever tried cross compiling?
No, the Pi4 is fast enough to compile MAME in a reasonable amount of time, especially if you only need a subset of drivers (or just use the
arcade
target and ignore any MESS systems). -
@retrolou said in Mame 64bit compile on RPI4b:
@dankcushions yes, I'm kinda using the retropie script, but i wanted specific versions of mame vs the latest. so I have been using the same make flags. The biggest improvement was setting the swap to 8192 or more to be sure. At one point i saw compiling eating up about 7GB, without that no way mame64 compiles on Pi4b even with 4gb memory.
to clarify, it builds fine with retropie's build scripts (have been building overnight to confirm). note that it uses 8GB swap for 64-bit builds and will use
-j2
you could have just adjusted the existing buildscript to point at the specific version you wanted: https://github.com/RetroPie/RetroPie-Setup/blob/master/scriptmodules/emulators/mame.sh#L21
-
I have tried cross compiling, however I found the "regenie" portions of the MAME build break for me.
I built a cross compile environment on x86, and regenie tools appeared to build as aarch64 and wouldn't run.
I then attempted to use distcc initiated from the Pi to the cross-compile environment on the x86 box, however distcc occasionally returned x86 objects, and broke the process.
I also looked at a Qemu aarch64 environment running on my x86 system, but it was half the speed of my RPi4, and mostly useless for compiling at that performance (even via distcc, to be honest).
In the end I just compile with -j4 up until the couple of objects that consume enormous amounts of RAM arrive in the queue, Control+C out, resume with -j1, wait for those objects to finish, then Control+C and finish off again with -j4. It still takes a considerable amount of time, but the binaries build fine.
If you want just the version 0.230 binaries, grab them from here (search the page for the word "executable":
https://stickfreaks.com/misc/raspberry-pi-mame-benchmarks -
@elvis thanks for the feedback about cross compiling. gonna research it a bit
-
I've managed to set up a cross-compile environment, and get a working MAME 0.230 build for Raspbian Buster 32bit armhf.
Documentation is here:
https://stickfreaks.com/misc/cross-compile-mame-for-raspberry-piIf anyone attempts this, please let me know whether you were successful or not.
-
I've updated the link above with guides for both 32bit and 64bit MAME cross compiles. Both verified and working on my setup, and confirmed by at least one other person. For me it takes an ~8 hour compile on my RPi4 overclocked to 2.0GHz down to a ~1 hour compile on my Core i5 machine.
I've added some links to scripts as well to hopefully make it a bit easier for people to get going. Still not automated end-to-end, but enough for someone familiar with package installation under Debian/Ubuntu to build a working cross compile environment.
I'm fairly confident this could be modified for anything running on RPi that uses gcc or g++ to compile, as long as the compile time headers and link time libraries were known, or could be discovered.
For example, if you want to find the dependencies for, say, ScummVM, install the "apt-rdepends" package on your RPi, and run:
apt-rdepends scummvm | grep -v ^' ' | sort | uniq | tr '\n' ' '
They're your runtime dependencies. To find build dependencies, ensure there's a matching "deb-src" repo for every "deb" repo in your /etc/apt/sources.list and your /etc/apt/sources.list/*list files, then run:
sudo apt-get build-dep scummvm
And log the files installed. You can find all dev packages installed with something like:
dpkg -l | grep '\-dev' | awk '{print $2}' | awk -F ':' '{print $1}
That would probably get you 99% of the way there. Ditto for anything where an older version is in the native Debian/Raspbian repos, and you want to build a much newer version.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.