Xcode 5 and phonegap: linker errors on building for device but not for simulator

Crashalot picture Crashalot · Mar 19, 2014 · Viewed 18.6k times · Source

Our phonegap app builds fine for the iphone simulator but generates linker errors when building the app on an iphone. the only thing that changed was installing testflight and a test app.

We already removed testflight and the test app, but the linker errors remain.

Any ideas on how to fix this?

We're on xcode 5 and phonegap 3.4.

Errors:

ld: warning: ignoring file /Users/c/Library/Developer/Xcode/DerivedData/s-fhgxmhdprdjvwahdbgwuagoragit/Build/Products/Debug-iphoneos/libCordova.a, file was built for archive which is not the architecture being linked (arm64): /Users/c/Library/Developer/Xcode/DerivedData/s-fhgxmhdprdjvwahdbgwuagoragit/Build/Products/Debug-iphoneos/libCordova.a
Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_CDVWebViewDelegate", referenced from:
      objc-class-ref in CDVInAppBrowser.o
  "_OBJC_METACLASS_$_CDVViewController", referenced from:
      _OBJC_METACLASS_$_MainViewController in MainViewController.o
  "_OBJC_CLASS_$_CDVPlugin", referenced from:
      _OBJC_CLASS_$_CDVDevice in CDVDevice.o
      _OBJC_CLASS_$_CDVConnection in CDVConnection.o
      _OBJC_CLASS_$_LowLatencyAudio in LowLatencyAudio.o
      _OBJC_CLASS_$_CDVLogger in CDVLogger.o
      _OBJC_CLASS_$_CDVInAppBrowser in CDVInAppBrowser.o
      _OBJC_CLASS_$_InAppPurchase in InAppPurchase.o
  "_OBJC_METACLASS_$_CDVPlugin", referenced from:
      _OBJC_METACLASS_$_CDVDevice in CDVDevice.o
      _OBJC_METACLASS_$_CDVConnection in CDVConnection.o
      _OBJC_METACLASS_$_LowLatencyAudio in LowLatencyAudio.o
      _OBJC_METACLASS_$_CDVLogger in CDVLogger.o
      _OBJC_METACLASS_$_CDVInAppBrowser in CDVInAppBrowser.o
      _OBJC_METACLASS_$_InAppPurchase in InAppPurchase.o
  "_OBJC_CLASS_$_CDVViewController", referenced from:
      _OBJC_CLASS_$_MainViewController in MainViewController.o
      objc-class-ref in CDVDevice.o
  "_CDVLocalNotification", referenced from:
      -[AppDelegate application:didReceiveLocalNotification:] in AppDelegate.o
  "_OBJC_METACLASS_$_CDVCommandDelegateImpl", referenced from:
      _OBJC_METACLASS_$_MainCommandDelegate in MainViewController.o
  "_OBJC_CLASS_$_CDVPluginResult", referenced from:
      objc-class-ref in CDVDevice.o
      objc-class-ref in CDVConnection.o
      objc-class-ref in LowLatencyAudio.o
      objc-class-ref in CDVInAppBrowser.o
      objc-class-ref in InAppPurchase.o
  "_OBJC_CLASS_$_CDVCommandDelegateImpl", referenced from:
      _OBJC_CLASS_$_MainCommandDelegate in MainViewController.o
  "_OBJC_CLASS_$_CDVUserAgentUtil", referenced from:
      objc-class-ref in CDVInAppBrowser.o
  "_OBJC_CLASS_$_CDVCommandQueue", referenced from:
      _OBJC_CLASS_$_MainCommandQueue in MainViewController.o
  "_OBJC_METACLASS_$_CDVCommandQueue", referenced from:
      _OBJC_METACLASS_$_MainCommandQueue in MainViewController.o
  "_CDVPluginHandleOpenURLNotification", referenced from:
      -[AppDelegate application:handleOpenURL:] in AppDelegate.o
      -[CDVInAppBrowser openInSystem:] in CDVInAppBrowser.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Answer

Manthan picture Manthan · Mar 19, 2014

This kind of problems occur while updating your Xcode but any third party tool you are using may not be updated with this architecture armv64.

So Click on your Project Navigator from XCode.

Click On Targets from your Project and click on BuildSettings from it.

Find Valid Architectures in it.

Just double click on that and remove armv64 from that.

Make sure there is armv7 and armv7s only.

In my case this worked for me.

Clean and build your project. It should work fine now.

Hope it helps you.

EDIT

Now, as of Feb 1st 2015, apple will not allow apps without arm64 architecture supported.

So make sure that all the apps submitted have arm64 support.