Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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)
like image 959
Crashalot Avatar asked Mar 19 '14 01:03

Crashalot


3 Answers

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.

like image 82
Manthan Avatar answered Sep 20 '22 09:09

Manthan


seems like we also unintentionally upgraded to xcode 5.1, causing the problem. phonegap 3.4 and xcode 5.1 are incompatible unless you make some changes.

here is the solution: http://shazronatadobe.wordpress.com/2014/03/12/xcode-5-1-and-cordova-ios/

like image 31
Crashalot Avatar answered Sep 22 '22 09:09

Crashalot


Sorry if this might seem like a trite answer, but the following steps are usually what I always do when I see linker errors :

  • Ensure your code is up to date, with all the latest fixes and versions.
  • Make sure you update your submodules. In git : git submodule update --init --recursive
  • Please do a Clean Build Folder : Go to Product, Hover on Clean and press together (Command + Option) and click on "Clean Build Folder".

Rinse and Repeat.

In case you have any modules that are not being references correctly, head over to your Build Phases, REMOVE the modules that are troubling you and re-add them.

like image 44
gran_profaci Avatar answered Sep 18 '22 09:09

gran_profaci