Reputation: 11
I'm trying to make one binary for both armv7 and arm64. I am using this command to compile a simple C file:
clang -arch arm64 hello.c -o hello -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
How can I add armv7 to this command to support old devices like the iPad 4? Knowing that xCode 9 stop supporting armv7 in iOS 11?
Upvotes: 1
Views: 3042
Reputation: 11580
As an update to Siguza's answer, the way to get SYSROOT as of Xcode 11 is:
xcrun --sdk iphoneos --show-sdk-path
Upvotes: 1
Reputation: 23820
Just add -arch armv7
:
clang -arch armv7 -arch arm64 hello.c -o hello -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
This will yield a fat binary with both architectures.
Also just a note, you can use xcrun
to avoid having to provide the full sys root:
xcrun -sdk iphoneos clang -arch armv7 -arch arm64
Upvotes: 4