Fix build for FreeBSD and quash all warnings.