Some fixes, including adding the appropriate libraries as flags