Posting this mostly as a reminder to myself for the next time I have to do this.
For those who don’t know, a statically linked binary is an executable that does not require any support libraries. All the required support libraries get included in the binary itself. This results in a binary that will run on any system of the right CPU type (i386, x86_64, ppc, etc.) The downside of this is that the resulting binary is going to be quite large. If you’re doing forensics on a system, it’s always handy to have a set of system utilities (ls, ps, sh, chown, chmod, netstat, vi, cp, rm, mkdir, rmdir, etc) that you have built yourself as statically linked binaries so you can trust them in case a system is root kitted.
Normally, when you download a tarball of source code, you’ll do the standard “configure; make; make install” to build it. If you want a statically linked binary, replace the plain “make” with:
make SHARED=0 CC='gcc -static'