Fixes for OS X (required removing -static flag and -pthreads flag, include endian.h