error code support

- return error code if compilation error occurs
- use asprintf to sprint errstr