I've experienced this error since a few months but was afraid to ask because of the backlash I got (deservedly) last time I had a problem compiling MAME and just hoped the error would eventually go away an update.
Here's what I'm doing: after downloading and unzipping the source (I do not touch the source tree in any way), I proceed to compilation (normally I'm using make -j8 TOOLS=1). Everything wents fine (besides a lot of warnings during compilation) and after a while I'm presented with an executable.
If I launch said executable, I'm getting the following error:
>zsh: exec format error: /Applications/Emulation/MAME/MAME
...copying shared history...
...saving history...truncating history files...
Deleting expired sessions...none found.
This only happens on my iMac Pro, on my M1 Mac mini the produced executable works just fine. I'm using the latest Xcode version 12.5.1.