OK, found the cause: if I compile on an external drive, the resulting file is not executable. Compiling on the internal drive results in a perfectly fine running MAME.

Is this something that is expected on macOS (11.5.2)?