For your information, I attempted to build MAME 0.172 on freshly installed Ubuntu and openSUSE Linux. The typical problem is that new people fail at building because they do not find out what packages to install, while those who are already doing builds for a longer time just don't remember what packages they installed in the past.

Packages to install for Ubuntu (15.10):

Code:
git
qt5-default
libsdl2-ttf-dev 
libfontconfig1-dev


Packages to install for openSUSE (42.1 LEAP)

Code:
git-core
gcc5-c++ 
libqt5-qtbase-devel
xorg-x11-devel
alsa-devel
libSDL2_ttf-devel


More packages are automatically pulled in by the dependencies resolution.