Feature/static build

This version fix the static build on macosx and linux. 

Tested on the latest ubuntu and macosx.