From: Micheal Smith on
I'm writing something to do asynchronous MX lookups using libresolv.
However when I try to compile I get the following errors.

undefined reference to `__ns_initparse'
undefined reference to `__ns_parserr'
undefined reference to `__ns_name_uncompress'

I know I can get around this using the -static switch to gcc, but that
seems to break other libraries which have problems with being statically
linked. Perhaps I'm using improper syntax. In this case I'm using the
following.
gcc -Wall -ggdb -o executable object.o object2.o -static -lresolv -lpam

I included pam because that's the library that seems to hiccup when
compiled with the static switch. If anyone has any insight on how to fix
this issue I'd greatly appreciate it. Also, I'd be open to insight on
possible other ways to implement such asynchronous lookups. I simply
used libresolv because it was the only quick way to accomplish the goal I
knew of. It sort of seems like I'm kludging this at the moment.