Workaround for clang linking errors

This solves issue #173.
I stripped down the g++ script, I'm not quite sure if everything is needed, but it works okay.
Is it needed for os x though?