10

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)
demongolem
  • 9,474
  • 36
  • 90
  • 105
Crashalot
  • 33,605
  • 61
  • 269
  • 439

3 Answers3

33

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.

Manthan
  • 3,856
  • 1
  • 27
  • 58
  • This worked for me too. I was using Cordova 3.6 + Xcode 6 and tried building for iPhone 6. It worked in the emulator, but the build was crashing for an iPhone 6 device. Removing armv64 as mentioned above fixed the problem. Thanks! – rc1 Sep 28 '14 at 02:05
  • @manthan. Performing the steps above leaves me with the following error when I try to build the xcodeproj file. Any ideas? Running MAC OSX 10.9.5 (Yosemite) `No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386` – Cornelius Parkin Oct 27 '14 at 11:02
  • @CorneliusParkin:For that,click on your project navigator, From there click on Targets, then in Architectures, set build active architrecture to NO. You will be good to go. – Manthan Oct 28 '14 at 04:22
  • Please delete this answer. People will try it and then see the edit at the bottom. – Fintan Kearney Dec 01 '17 at 09:50
8

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/

Crashalot
  • 33,605
  • 61
  • 269
  • 439
  • Thanks man this is working, really hate Apple's updates ... same happened with Mavericks, completely destroyed my RSA keys and GCC/command tools – d1jhoni1b Apr 01 '14 at 23:53
1

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.

gran_profaci
  • 8,087
  • 15
  • 66
  • 99