Recently I needed to compile a binary to place on an embedded system. The catch is the binary depended on a newer version of a library than existed on the target system. In order to make the fewest changes possible on my target system, I needed a way to statically link the newer library without the bloat of statically compiling the entire binary.
The following explores a simple example of statically linking specific libraries, it was tested on FreeBSD but should apply to Linux, BSD, or any other system using gcc.
Continue reading