Undefined symbols for architecture arm64

437,260

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: enter image description here

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:

enter image description here

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:

  1. Go to your Project
  2. Select your Target
  3. Then, go to Build Phases
  4. Open Link Binary With Libraries
  5. 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/

enter image description here

Share:
437,260

Related videos on Youtube

GangstaGraham
Author by

GangstaGraham

Updated on July 08, 2022

Comments

  • GangstaGraham
    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
      Mihir Oza over 8 years
      Simple Solution Go to Target ->Linking -> other linker Flag and add $(inherited) in other linker flag in both Debug and Release.
  • GangstaGraham
    GangstaGraham over 10 years
    This 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
    GangstaGraham over 10 years
    Ok, I got this by setting Build For Active Architectures To Yes. Thank you so much!
  • funroll
    funroll over 10 years
    Aside: you can use the file command in Terminal to tell what architectures a static library supports.
  • shim
    shim over 10 years
    These 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
    GangstaGraham over 10 years
    I had a similar problem when using XCode 5.1 for the first time, this fixed it. Thanks!
  • AdamG
    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
    shim over 10 years
    Actually 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
    Wells over 10 years
    Just came in here to add to the chorus: selecting YES for BUILD FOR ACTIVE ARCHITECTURES is the best option here.
  • onmyway133
    onmyway133 about 10 years
    @morisunshine are you sure, have you check the binary architectures after build ?
  • morisunshine
    morisunshine about 10 years
    @onmyway133 I have checked, but now I haven't meet this problem in the new XCode.
  • onmyway133
    onmyway133 about 10 years
    @morisunshine yeah, I mean you lose the arm64
  • Luke Smith
    Luke Smith about 10 years
    Thanks. I was experiencing this issue when using YAJL-Objc. Seemingly working now. Thanks.
  • MCMatan
    MCMatan almost 10 years
    You are an amazing person. Thanks
  • Admin
    Admin over 9 years
    This is no longer a solution. Apple now demands support for 64 bit for all deployments.
  • KrispyDonuts
    KrispyDonuts over 9 years
    I 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
    Paul Brewczynski about 9 years
    @chancyWu Could you explain?
  • NFerocious
    NFerocious about 9 years
    Hey, can we submit in AppStore using that "Build Active Architecture Only" to YES? isn't it required to be NO? thanks
  • zeeawan
    zeeawan about 9 years
    No 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
    Enrico Susatyo about 9 years
    also if this still doesn't work, add @(inherited) to Library Search Paths too.
  • Fengya Li
    Fengya Li about 9 years
    when you say setting "ARCHS=XXX", where to set? Im new to iOS and I use swift.
  • morisunshine
    morisunshine about 9 years
    @larry I'm not sure is it work to swift,but you can set this in "Build settings"
  • Kirit  Vaghela
    Kirit Vaghela almost 9 years
  • Sushil Sharma
    Sushil Sharma almost 9 years
    Lol , ignored Use the $(inherited) flag terminal warning. And error brought me here. saved my day.
  • heading_to_tahiti
    heading_to_tahiti almost 9 years
    This is not the Solution, all apps need support for 64 bit now. @chancyWu solution is the correct one.
  • Post Impatica
    Post Impatica over 8 years
    Not the exact same issue as you but similar. I resolved it with the same method you provided.
  • Kristen Waite
    Kristen Waite over 8 years
    Yeah, 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
    Matt over 8 years
    That is so unbelievably FUBARed! The output of XCode depends on what device you have connected to the build machine!
  • Alessandra
    Alessandra over 8 years
    I'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
    Elad over 8 years
    set BUILD ACTIVE ARCHITECTURE ONLY to NO in PODS project also!
  • Felipe
    Felipe about 8 years
    As strange as this may seem this actually worked. Thanks, mate.
  • Nirmalsinh Rathod
    Nirmalsinh Rathod about 8 years
    You saved my lots of time. Thanks.
  • L_Sonic
    L_Sonic about 8 years
    Manually deleting derived data, did the trick for me as well. Cheers!
  • Stefano Buora
    Stefano Buora almost 8 years
    Thank you! I would like to add an hints: the folder is under /User/yourname/Library/Developer/XCode/DerivedData
  • nr5
    nr5 over 7 years
    what 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
    sam_smith about 7 years
    You should also be able to delete derived data using the terminal: rm -rf ~/Library/Developer/Xcode/DerivedData
  • HelloimDarius
    HelloimDarius about 7 years
    Was trying to add Tesseract framework, and only this helped me, thanks. !
  • iluvatar_GR
    iluvatar_GR almost 7 years
    that worked for me also but was one easy pod with one file.
  • iHTCboy
    iHTCboy almost 7 years
    good job. ` "_OBJC_CLASS_$_XXXXXClass", referenced from:`,, add xxx Framework.
  • Amr Hossam
    Amr Hossam over 6 years
    Xcode 9 doesn't apply this automatically, even if checked the checkbox. Thank you.
  • Morphing Coffee
    Morphing Coffee over 6 years
    Spot on! Anyone who sees anything with 'xml' printed check this out - in my case it was 'libxml' framework not being linked.
  • Nick B
    Nick B over 6 years
    thannkkkkkkk youuuuuuu I was stuck on this for a long time
  • Csaba Toth
    Csaba Toth over 6 years
    @AdamG Is AT&T Speech to Text API still exists/operational?
  • stellar lee
    stellar lee about 6 years
    After 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
    Hsiao-Ting about 6 years
    Saved my time ... XDDD
  • JeremyF
    JeremyF about 6 years
    Worked sorta... Now I am getting "Invalid bitcode signature" error.
  • Jonny
    Jonny about 6 years
    Probably sameish as this answer, but "Clean build folder" helped me. ⌥⇧⌘K
  • magneticrob
    magneticrob about 6 years
    Manually deleting derived data worked for me too - this was after updating CocoaPods
  • Vad
    Vad almost 6 years
    Worked for me well!
  • user287474
    user287474 over 5 years
    @chancyWu maybe you can help with my issue
  • Ignacio Hernández
    Ignacio Hernández over 5 years
    That was the problem. Thankyou
  • Udaya Sri
    Udaya Sri almost 4 years
    I kept only $(inherited) in Other Linker Flags & it worked.
  • famfamfam
    famfamfam about 3 years
    where did u replace? project or pod
  • Mithra Singam
    Mithra Singam about 3 years
    try adding in project
  • Jav Solo
    Jav Solo almost 3 years
    I 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!