finally got correct library linking on mac os x