this is because Gem relies on OpenGL and thus you need OpenGL header to build it...
those few line should help to get the right things *before* running ./configure script
apt-get update -qq
apt-get build-dep gem -qq
apt-get install libglfw-dev libglfw3-dev libsdl2-dev -qq
Also to enable vlc plugin you should install libvlc-dev pt-ackage :
apt-get install libvlc-dev
And since there are few discussion on building Gem on Linux, I thing we should start a "Hpw to build Gem on Ubuntu" wiki page.
Since there are now Travis script to do so automatically it should be quite straightforward.
+
a