More robust linking with shared libraries.

Because we've interpolated the string, we need to pick off "lib" and
pass -lfoo for libfoo.so/.dylib to make UNIX tools happy.