Mach-O Linker Error Xcode 5

11,921

Solution 1

Remove armv7s from valid architectures section and it will work.

Build Settings --> Architectures --> Valid Architectures

enter image description here

Solution 2

Change the Buid setting ---> Architecture ---> Build Active Architecture only ---> Yes This solved my issue for using old cordova versions in new Xcode 5

Solution 3

I had the same problem and the issue was that I have accidently imported a .m file instead of .h in an implementation file - hope it helps

Share:
11,921
Sana
Author by

Sana

Updated on June 29, 2022

Comments

  • Sana
    Sana almost 2 years

    I have just updated my Xcode to version 5.0.2 And after updating, all my previously running apps (*perfectly running and archiving) are now giving following errors when I try to archive them for testing on my devices (not connected devices).

    Ld /Users/dharammalik/Library/Developer/Xcode/DerivedData/lite_test-hblolzuqyvugvdfpenjeoxvmovrk/Build/Intermediates/ArchiveIntermediates/lite_test/IntermediateBuildFilesPath/lite_test.build/Release-iphoneos/lite_test.build/Objects-normal/armv7s/lite_test normal armv7s
        cd /Users/dharammalik/Documents/PhonegapWorkspace/lite_test
        setenv IPHONEOS_DEPLOYMENT_TARGET 5.0
        setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -L/Users/dharammalik/Library/Developer/Xcode/DerivedData/lite_test-hblolzuqyvugvdfpenjeoxvmovrk/Build/Intermediates/ArchiveIntermediates/lite_test/BuildProductsPath/Release-iphoneos -F/Users/dharammalik/Library/Developer/Xcode/DerivedData/lite_test-hblolzuqyvugvdfpenjeoxvmovrk/Build/Intermediates/ArchiveIntermediates/lite_test/BuildProductsPath/Release-iphoneos -filelist /Users/dharammalik/Library/Developer/Xcode/DerivedData/lite_test-hblolzuqyvugvdfpenjeoxvmovrk/Build/Intermediates/ArchiveIntermediates/lite_test/IntermediateBuildFilesPath/lite_test.build/Release-iphoneos/lite_test.build/Objects-normal/armv7s/lite_test.LinkFileList -dead_strip -weak_framework CoreFoundation -weak_framework UIKit -weak_framework AVFoundation -weak_framework CoreMedia -weak-lSystem -all_load -Obj-C -fobjc-link-runtime -miphoneos-version-min=5.0 -framework CoreLocation -framework ImageIO -framework OpenAL -framework AssetsLibrary /Users/dharammalik/Library/Developer/Xcode/DerivedData/lite_test-hblolzuqyvugvdfpenjeoxvmovrk/Build/Intermediates/ArchiveIntermediates/lite_test/BuildProductsPath/Release-iphoneos/libCordova.a -framework Foundation -weak_framework UIKit -framework CoreGraphics -framework AddressBook -framework AddressBookUI -framework AudioToolbox -weak_framework AVFoundation -framework CFNetwork -framework MediaPlayer -framework QuartzCore -framework SystemConfiguration -framework MobileCoreServices -weak_framework CoreMedia -framework CoreLocation -Xlinker -dependency_info -Xlinker /Users/dharammalik/Library/Developer/Xcode/DerivedData/lite_test-hblolzuqyvugvdfpenjeoxvmovrk/Build/Intermediates/ArchiveIntermediates/lite_test/IntermediateBuildFilesPath/lite_test.build/Release-iphoneos/lite_test.build/Objects-normal/armv7s/lite_test_dependency_info.dat -o /Users/dharammalik/Library/Developer/Xcode/DerivedData/lite_test-hblolzuqyvugvdfpenjeoxvmovrk/Build/Intermediates/ArchiveIntermediates/lite_test/IntermediateBuildFilesPath/lite_test.build/Release-iphoneos/lite_test.build/Objects-normal/armv7s/lite_test
    
    ld: warning: ignoring file /Users/dharammalik/Library/Developer/Xcode/DerivedData/lite_test-hblolzuqyvugvdfpenjeoxvmovrk/Build/Intermediates/ArchiveIntermediates/lite_test/BuildProductsPath/Release-iphoneos/libCordova.a, file was built for archive which is not the architecture being linked (armv7s): /Users/dharammalik/Library/Developer/Xcode/DerivedData/lite_test-hblolzuqyvugvdfpenjeoxvmovrk/Build/Intermediates/ArchiveIntermediates/lite_test/BuildProductsPath/Release-iphoneos/libCordova.a
    Undefined symbols for architecture armv7s:
      "_OBJC_METACLASS_$_CDVCommandDelegateImpl", referenced from:
          _OBJC_METACLASS_$_MainCommandDelegate in MainViewController.o
      "_CDVLocalNotification", referenced from:
          -[AppDelegate application:didReceiveLocalNotification:] in AppDelegate.o
      "_OBJC_CLASS_$_CDVCommandDelegateImpl", referenced from:
          _OBJC_CLASS_$_MainCommandDelegate in MainViewController.o
      "_OBJC_CLASS_$_CDVCommandQueue", referenced from:
          _OBJC_CLASS_$_MainCommandQueue in MainViewController.o
      "_OBJC_METACLASS_$_CDVViewController", referenced from:
          _OBJC_METACLASS_$_MainViewController in MainViewController.o
      "_OBJC_METACLASS_$_CDVCommandQueue", referenced from:
          _OBJC_METACLASS_$_MainCommandQueue in MainViewController.o
      "_CDVPluginHandleOpenURLNotification", referenced from:
          -[AppDelegate application:handleOpenURL:] in AppDelegate.o
      "_OBJC_CLASS_$_CDVViewController", referenced from:
          _OBJC_CLASS_$_MainViewController in MainViewController.o
    ld: symbol(s) not found for architecture armv7s
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    

    Tried changing the Architectures, but nothing worked. Any idea how to resolve these issues? They were not there at all in the previous version of Xcode I had.