Adding -pthread.
Fixing drawing sql.