If you download and install programs from source on Ubuntu / Debian you may have been through the process of running ./configure, then noting what it complains is missing, then apt-get install missing <package name>, then repeat till you have everything you need.
There is a better way:
apt-get build-dep <package_name>
This will get all the dependencies needed to compile your package – providing that package_name is something that would normally install using a simple apt-get install command.
If you wanted to download and install the latest version of gnucash from tar.gz. You would run:
apt-get build-dep gnucash
Prior to untarring and configuring the source archive, and the build-dep command would pull in the inumerable build dependencies required.
This tip is taken from the gnucash-users mailing list.