Fix compilation on FreeBSD where libdl is part of libc