add osx toolchain for cmake & fix bugs