add '-lperl -pthread' to LDFLAGS

should close https://github.com/NixOS/nix/issues/346