RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Mame 64bit compile on RPI4b

    Scheduled Pinned Locked Moved Help and Support
    mamecompiling mamecross compiling
    13 Posts 4 Posters 2.2k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      retrolou
      last edited by

      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.

      dankcushionsD 1 Reply Last reply Reply Quote 0
      • dankcushionsD
        dankcushions Global Moderator @retrolou
        last edited by dankcushions

        @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.

        1 Reply Last reply Reply Quote 0
        • R
          retrolou
          last edited by

          @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?

          dankcushionsD 2 Replies Last reply Reply Quote 0
          • dankcushionsD
            dankcushions Global Moderator @retrolou
            last edited by dankcushions

            @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

            R 1 Reply Last reply Reply Quote 0
            • R
              retrolou @dankcushions
              last edited by retrolou

              @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=python3

              GPU 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

              mituM 1 Reply Last reply Reply Quote 0
              • mituM
                mitu Global Moderator @retrolou
                last edited by mitu

                @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.

                R 1 Reply Last reply Reply Quote 0
                • R
                  retrolou @mitu
                  last edited by

                  @mitu yeah i have been able with the 8gb swap, actually compile with j4. have you ever tried cross compiling?

                  mituM 1 Reply Last reply Reply Quote 0
                  • mituM
                    mitu Global Moderator @retrolou
                    last edited by

                    @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).

                    1 Reply Last reply Reply Quote 0
                    • dankcushionsD
                      dankcushions Global Moderator @retrolou
                      last edited by

                      @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

                      1 Reply Last reply Reply Quote 0
                      • E
                        elvis
                        last edited by

                        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

                        R 1 Reply Last reply Reply Quote 0
                        • R
                          retrolou @elvis
                          last edited by

                          @elvis thanks for the feedback about cross compiling. gonna research it a bit

                          E 1 Reply Last reply Reply Quote 0
                          • E
                            elvis @retrolou
                            last edited by

                            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-pi

                            If anyone attempts this, please let me know whether you were successful or not.

                            E 1 Reply Last reply Reply Quote 1
                            • E
                              elvis @elvis
                              last edited by

                              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.

                              1 Reply Last reply Reply Quote 0
                              • First post
                                Last post

                              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.