Add missing linking with zlib and libpthread/librt
The uncompress and sem_* functions are used by various parts of the code
but the files built from that code were not linked with zlib/pthread/rt.
This fixes building with the --no-add-needed linker option.