Changes necessary to compile for iOS

Here are the discussed changes to add support to cross-compile for iOS.