Undefined symbols for architecture arm64
Solution 1
If your Architectures and Valid Architectures are all right, you may check whether you have added $(inherited)
, which will add linker flags generated in pods, to Other Linker Flags as below:
Solution 2
The issue is that the cocoapods have not been built for arm64 architecture yet thus they cannot be linked when you build them. Likely you cannot use those packages until they are updated and use that architecture. You can fix the linker error by going to project -> target (your project name) -> build settings and change architectures to standard architectures (armv7, armv7s), and valid architectures to armv7, armv7s.
Note though, this means you won't get the full power of the 64 bit processor. You said you are building for the 5s, so there may be some reason you need this. If you for some reason absolutely need that power (perhaps you are building a game), and desperately need those files, you could submit a pull request and then recompile the project to arm64 by setting those same fields to arm64 in the files you pulled from the open source projects. But, unless you really need these files to be 64 bit compatible, that seems like a bit of overkill for now.
EDIT: Some people also reported that setting Build For Active Architectures to YES was also necessary to solve this problem.
As of 2014-04-28 the setting should look something like this:
Solution 3
I solved this problem by setting that:
ARCHS = armv7 armv7s
VALID_ARCHS = armv6 armv7 armv7s arm64
Solution 4
I ran into the same/similar issue implementing AVPictureInPictureController
and the issue was that I wasn't linking the AVKit framework in my project.
The error message was:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_AVPictureInPictureController", referenced from:
objc-class-ref in yourTarget.a(yourObject.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The Solution:
- Go to your Project
- Select your Target
- Then, go to Build Phases
- Open Link Binary With Libraries
- Finally, just add + the AVKit framework / any other framework.
Hopefully this helps someone else running into a similar issue I had.
Solution 5
I also encountered the same problem , the above methods will not work . I accidentally deleted the files in the following directory on it .
Folder emplacement:
~/Library/Developer/Xcode/DerivedData/
Related videos on Youtube
GangstaGraham
Updated on July 08, 2022Comments
-
GangstaGraham almost 2 years
I am getting a Apple Mach-O Linker Error everytime I import a file from CocoaPods.
Undefined symbols for architecture arm64: "_OBJC_CLASS_$_FBSession", referenced from: someFile ld: symbol(s) not found for architecture arm64
I get about 12 of these, for the various Pods I use.
I am trying to build for the iPhone 5S using XCode 5.
I've been trying various solutions here on SO, but haven't got any of them to work yet.
How do I fix this Apple Mach-O Linker Error?
Just found another warning that might be interesting, I hope this leads me to the solution:
Ignoring file ~/Library/Developer/Xcode/DerivedData/SomeApp/Build/Products/Debug-iphoneos/libPods.a,
file was built for archive which is not the architecture being linked
(arm64):~/Library/Developer/Xcode/DerivedData/someApp/Build/Products/Debug-iphoneos/libPods.a
-
Mihir Oza over 8 yearsSimple Solution Go to Target ->Linking -> other linker Flag and add $(inherited) in other linker flag in both Debug and Release.
-
-
GangstaGraham over 10 yearsThis solved the error, for running on the simulator, however, it did not solve the error for running on the device. Pods was rejected for libPods.a because its architectures '' (for some reason, it isn't detecting it - although I can see it in Xcode) didn't contain all required architectures 'armv7 armv7s'
-
GangstaGraham over 10 yearsOk, I got this by setting Build For Active Architectures To Yes. Thank you so much!
-
funroll over 10 yearsAside: you can use the
file
command in Terminal to tell what architectures a static library supports. -
shim over 10 yearsThese suggestions didn't fix it for me... I still get "Pods was rejected as an implicit dependency for libPods.a because its architectures arm64 didn't contain all required architectures armv7 armv7s
-
GangstaGraham over 10 yearsI had a similar problem when using XCode 5.1 for the first time, this fixed it. Thanks!
-
AdamG over 10 years@shim this happened to the initial poster. It looks like the solution is to also set "Build For Active Architectures" to "yes."
-
shim over 10 yearsActually the solution that worked for me was to set it to "No" but also had to do this for the "Pods" project in the workspace, since they're separate.
-
Wells over 10 yearsJust came in here to add to the chorus: selecting YES for BUILD FOR ACTIVE ARCHITECTURES is the best option here.
-
onmyway133 about 10 years@morisunshine are you sure, have you check the binary architectures after build ?
-
morisunshine about 10 years@onmyway133 I have checked, but now I haven't meet this problem in the new XCode.
-
onmyway133 about 10 years@morisunshine yeah, I mean you lose the arm64
-
Luke Smith about 10 yearsThanks. I was experiencing this issue when using YAJL-Objc. Seemingly working now. Thanks.
-
MCMatan almost 10 yearsYou are an amazing person. Thanks
-
Admin over 9 yearsThis is no longer a solution. Apple now demands support for 64 bit for all deployments.
-
KrispyDonuts over 9 yearsI tried it with the method listed in the answer and it was still giving me issues (but with armv7s now). It looks like the latest version of OpenCV is the culprit. I tried it with v2.4.9.1 and the app now builds fine. This is what I have in the Podfile:
pod 'OpenCV', '~> 2.4.9.1'
-
Paul Brewczynski about 9 years@chancyWu Could you explain?
-
NFerocious about 9 yearsHey, can we submit in AppStore using that "Build Active Architecture Only" to YES? isn't it required to be NO? thanks
-
zeeawan about 9 yearsNo more build errors, up-to this point it is OK. But while uploading the archived build, I'm getting arm64 bit missing error as arm64 bit support is a compulsion from Feb 1, 2015.
-
Enrico Susatyo about 9 yearsalso if this still doesn't work, add @(inherited) to Library Search Paths too.
-
Fengya Li about 9 yearswhen you say setting "ARCHS=XXX", where to set? Im new to iOS and I use swift.
-
morisunshine about 9 years@larry I'm not sure is it work to swift,but you can set this in "Build settings"
-
Kirit Vaghela almost 9 years
-
Sushil Sharma almost 9 yearsLol , ignored
Use the $(inherited) flag
terminal warning. And error brought me here. saved my day. -
heading_to_tahiti almost 9 yearsThis is not the Solution, all apps need support for 64 bit now. @chancyWu solution is the correct one.
-
Post Impatica over 8 yearsNot the exact same issue as you but similar. I resolved it with the same method you provided.
-
Kristen Waite over 8 yearsYeah, worth mentioning that this is an error that gets thrown if you're missing a framework. One clue is you try removing architectures and the next/remaining one fails too...
-
Matt over 8 yearsThat is so unbelievably FUBARed! The output of XCode depends on what device you have connected to the build machine!
-
Alessandra over 8 yearsI'm working with Xcode 7.2 and in Other Linker Flags -> Debug I see: -weak_framework CoreFoundation -weak_framework UIKit -weak_framework AVFoundation -weak_framework CoreMedia -weak-lSystem -ObjC ... here I added $(inherited) but it doesn't work
-
Elad over 8 yearsset BUILD ACTIVE ARCHITECTURE ONLY to NO in PODS project also!
-
Felipe about 8 yearsAs strange as this may seem this actually worked. Thanks, mate.
-
Nirmalsinh Rathod about 8 yearsYou saved my lots of time. Thanks.
-
L_Sonic about 8 yearsManually deleting derived data, did the trick for me as well. Cheers!
-
Stefano Buora almost 8 yearsThank you! I would like to add an hints: the folder is under /User/yourname/Library/Developer/XCode/DerivedData
-
nr5 over 7 yearswhat is the purpose of $(inherited) if the extension which uses the library from the target in which it is already embeded. Why cant it pick it automatically.
-
sam_smith about 7 yearsYou should also be able to delete derived data using the terminal: rm -rf ~/Library/Developer/Xcode/DerivedData
-
HelloimDarius about 7 yearsWas trying to add Tesseract framework, and only this helped me, thanks. !
-
iluvatar_GR almost 7 yearsthat worked for me also but was one easy pod with one file.
-
iHTCboy almost 7 yearsgood job. ` "_OBJC_CLASS_$_XXXXXClass", referenced from:`,, add xxx Framework.
-
Amr Hossam over 6 yearsXcode 9 doesn't apply this automatically, even if checked the checkbox. Thank you.
-
Morphing Coffee over 6 yearsSpot on! Anyone who sees anything with 'xml' printed check this out - in my case it was 'libxml' framework not being linked.
-
Nick B over 6 yearsthannkkkkkkk youuuuuuu I was stuck on this for a long time
-
Csaba Toth over 6 years@AdamG Is AT&T Speech to Text API still exists/operational?
-
stellar lee about 6 yearsAfter modifying the introduction of pod, this error occurred, and all methods were not fixed. But your method fixes the problem. Note: lib cannot be searched.
-
Hsiao-Ting about 6 yearsSaved my time ... XDDD
-
JeremyF about 6 yearsWorked sorta... Now I am getting "Invalid bitcode signature" error.
-
Jonny about 6 yearsProbably sameish as this answer, but "Clean build folder" helped me. ⌥⇧⌘K
-
magneticrob about 6 yearsManually deleting derived data worked for me too - this was after updating CocoaPods
-
Vad almost 6 yearsWorked for me well!
-
user287474 over 5 years@chancyWu maybe you can help with my issue
-
Ignacio Hernández over 5 yearsThat was the problem. Thankyou
-
Udaya Sri almost 4 yearsI kept only
$(inherited)
inOther Linker Flags
& it worked. -
famfamfam about 3 yearswhere did u replace? project or pod
-
Mithra Singam about 3 yearstry adding in project
-
Jav Solo almost 3 yearsI had this same issue with a very large project I am working on at work. It is cocoapod hell. However, my solution was to uncheck the target membership for the issues I was getting. Thanks for pointing me in the right direction!