An interesting question I had to answer a couple months ago was - how could I compile an executable statically, so then it works on various linux distributions without the need to install some additional libs. Of course, such the executables are bigger as that, which was compiled in order to use the dynamic libs. But if one wanna to have an independent production executable, this is what one could need.
So, I will explain the thing with the help of an example program, which uses ncurses. First I'm creating the project dir, for example:
BASH:
user@host~$ mkdir ~/programming/static_test
user@host~$ cd ~/programming/static_test