Added Mesa build for OSMesa offscreen rendering support and fixed errors.