Fixes build using gcc 4.9 with LTO.

Otherwise sem_close is not found.
Merge pull request #1051 from TheMarex/linker-fix

Fix linking for linux