I'm not sure if you need to go back as far as 12.04. I see you have that installed already though.
You need to install some development packages before you can compile. I would expect these...
build-essential
debian control file lists these...
debhelper, pkg-config, libavahi-client-dev, libssl-dev, zlib1g-dev, wget, bzip2, libcurl4-gnutls-dev, git-core
12.04 packages are moved to http://old-releases.ubuntu.com You might need to look at your sources lists in /etc/apt and edit the url before apt can find packages for your system. If you have to do this run sudo apt-get update after you edit the URLS. Then you should be able to install packages.