What did you have difficulty compiling?
Previously, I had to build SFML from source b/c the ubuntu libraries only contained the 1.X versions, rather than the 2.X version that attract-mode requires.
Also, I think that Debian/Ubuntu moved back to using FFMPEG's libraries, rather than libav, so the updated libswscale, etc are all available.
I think I did an apt-get builddep mame, and that pulled in all kinds of libs, probably way more than was needed to build attract-mode.
Also, I'll report that none of those changes made a difference in keeping attract-mode from launching dozens of mame windows. If i run the games from the command line, they work fine, obviously, I played a couple button mashers for a while. As soon as I launch them from attract-mode, pressing P1B1 causes it to launch another copy of the game.