Building for iOS5 with XCode 8

Part of my day job is creating a mobile app, of which one of the platforms we deploy to is iOS. We still have some users out there on iPad 1’s and the latest version of iOS that’s available for them is 5.1.1, which the latest version of XCode (version 8.1 at time of writing) doesn’t support.

Up to and including XCode 8.0 we’ve been able to build for iOS5 without trouble just by changing the “Development Target” setting to 5.1.1, however XCode 8.1 complains with an error “ld: library not found for -lcrt1.3.1.o”. Turns out that the iOS10 SDK doesn’t ship with this file any more, effectively dropping support for iPad1’s.

Fortunately the solution is simple, to take a copy of crt1.3.1.o from an older copy of XCode and put it into the /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/ folder, and just like that it’s possible to build for iOS5 again.