In Xcode 6.1 , I am getting error for iPhone 6, iPhone 5s(iOS 7.1) which says
Undefined symbols for architecture x86_64:
\"_OBJC_CLASS_$_ClientAut
The first thing you should make sure is that your static library has all architectures. When you do a lipo -info myStaticLibrary.a
on terminal - you should see armv7 armv7s i386 x86_64 arm64
architectures for your fat binary.
To accomplish that, I am assuming that you're making a universal binary - add the following to your architecture settings of static library project -
Standard architectures (including 64-bit) (armv7, armv7s, arm64)
of the static library project.$ARCHS_STANDARD
now includes 64-bit. You can also do $(ARCHS_STANDARD)
and armv7s
. Check lipo -info
without it, and you'll figure out the missing architectures. Here's the screenshot for all architectures -For your reference implementation (project using static library). The default settings should work fine -
Update 12/03/14 Xcode 6 Standard architectures exclude armv7s.
So, armv7s
is not needed? Yes. It seems that the general differences between armv7 and armv7s instruction sets are minor. So if you choose not to include armv7s, the targeted armv7 machine code still runs fine on 32 bit A6 devices, and hardly one will notice performance gap. Source
If there is a smarter way for Xcode 6.1+ (iOS 8.1 and above) - please share.
Here's a response to your latest question about the difference between x86_64
and arm64
:
x86_64
architecture is required for running the 64bit simulator.
arm64
architecture is required for running the 64bit device (iPhone
5s, iPhone 6, iPhone 6 Plus, iPad Air, iPad mini with Retina
display).
If you are building a universal library and need to support the Simulator (x86_64) then build the framework for all platforms by setting Build Active Architecture Only
to No
.
Setting the build active architectures only to No fixed this problem for me.
One other thing to look out for is that XCode is badly handling the library imports, and in many cases the solution is to find the imported file in your project, delete it in Finder or from the command line and add it back again, otherwise it won't get properly updated by XCode. By XCode leaving there the old file you keep running in circles not understanding why it is not compiling, missing the architecture etc.
I use lipo
command to combine two built static libraries manually.
EX: I have a static library(libXYZ.a) to build.
I run build for Generic iOS Device
and got Product in Debug-iphoneos/
$ lipo -info Debug-iphoneos/libXYZ.a
Architectures in the fat file: Debug-iphoneos/libXYZ.a are: armv7 arm64
Then I run build for any iOS Simulator
and got Product in Debug-iphonesimulator/
$ lipo -info Debug-iphonesimulator/libXYZ.a
Architectures in the fat file: Debug-iphonesimulator/libXYZ.a are: i386 x86_64
Finally I combine into one to contain all architectures.
$ lipo -create Debug-iphoneos/libXYZ.a Debug-iphonesimulator/libXYZ.a -output libXYZ.a
$ lipo -info libXYZ.a
Architectures in the fat file: libXYZ.a are: armv7 i386 x86_64 arm64