Fix linking on OSX
Merge pull request #1653 from tobbi/fix_mac_linking

Fix linking on OSX