add portability fixes for toolchain/tools (full tools/toolchain build works on osx...