Fix up some cross compile, missing header, moved includes, copyleft.