5

I have updated my XCode to 6.0.1 Before this update, I was able to build my project in both simulator and in my device. But now, it is giving me Apple Mach-O Linker Error

I surfed a lot. I have deleted the DerivedData folder. Still having the Problem.

I am building a Phonegap App. Please help me.

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_CDVWebViewDelegate", referenced from:
      objc-class-ref in CDVInAppBrowser.o
  "_OBJC_CLASS_$_CDVInvokedUrlCommand", referenced from:
      objc-class-ref in CDVContacts.o
      objc-class-ref in CDVFile.o
  "_OBJC_METACLASS_$_CDVViewController", referenced from:
      _OBJC_METACLASS_$_MainViewController in MainViewController.o
  "_OBJC_CLASS_$_CDVPlugin", referenced from:
      _OBJC_CLASS_$_CDVLogger in CDVLogger.o
      _OBJC_CLASS_$_CDVContacts in CDVContacts.o
      _OBJC_CLASS_$_CDVDevice in CDVDevice.o
      _OBJC_CLASS_$_CDVNotification in CDVNotification.o
      _OBJC_CLASS_$_CDVFile in CDVFile.o
      _OBJC_CLASS_$_CDVFileTransfer in CDVFileTransfer.o
      _OBJC_CLASS_$_CDVInAppBrowser in CDVInAppBrowser.o
      ...
  "_OBJC_METACLASS_$_CDVPlugin", referenced from:
      _OBJC_METACLASS_$_CDVLogger in CDVLogger.o
      _OBJC_METACLASS_$_CDVContacts in CDVContacts.o
      _OBJC_METACLASS_$_CDVDevice in CDVDevice.o
      _OBJC_METACLASS_$_CDVNotification in CDVNotification.o
      _OBJC_METACLASS_$_CDVFile in CDVFile.o
      _OBJC_METACLASS_$_CDVFileTransfer in CDVFileTransfer.o
      _OBJC_METACLASS_$_CDVInAppBrowser in CDVInAppBrowser.o
      ...
  "_OBJC_CLASS_$_CDVViewController", referenced from:
      _OBJC_CLASS_$_MainViewController in MainViewController.o
      objc-class-ref in CDVDevice.o
      objc-class-ref in CDVFile.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 CDVContacts.o
      objc-class-ref in CDVDevice.o
      objc-class-ref in CDVNotification.o
      objc-class-ref in CDVFile.o
      objc-class-ref in CDVLocalFilesystem.o
      objc-class-ref in CDVAssetLibraryFilesystem.o
      objc-class-ref in CDVFileTransfer.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)
Prabakaran Raja
  • 720
  • 1
  • 11
  • 27
  • You need to post the actual linker error messages. – Paul R Sep 25 '14 at 10:58
  • @PaulR See the edit. Is this enough? – Prabakaran Raja Sep 25 '14 at 11:03
  • That helps - it looks like you're missing a bunch of stuff from the Cordova framework ? – Paul R Sep 25 '14 at 11:06
  • @PrabakaranRaja: Please see my this answer http://stackoverflow.com/questions/22494615/xcode-5-and-phonegap-linker-errors-on-building-for-device-but-not-for-simulator/22497592#22497592 – Manthan Sep 25 '14 at 11:07
  • yes. It is showing me 15! – Prabakaran Raja Sep 25 '14 at 11:07
  • remove armv64 from your valid architectures and you will be good to go. – Manthan Sep 25 '14 at 11:08
  • @Manthan. If i remove the arm64, it is showing me a Dependency Error – Prabakaran Raja Sep 25 '14 at 11:11
  • I removed everything except `armv7` as suggested by @PrabakaranRaja in his answer to the other question. At first it didn't work, but eventually I found that I had to remove it both from the main project **and from CordovaLib.xcodeproj** (which shows up in the navigator around half way down). – DenisH Oct 08 '14 at 12:19
  • I uninstalled the whole XCode 6. I updated the phonegap in my mac and reinstalled it again. Created a new phonegap project. Copied the code (www folder) into the new project. Build it. And it is working fine in XCode 6. Sorry for the delayed reply – Prabakaran Raja Apr 22 '15 at 10:14

5 Answers5

6

This kind of problems generally 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.

If this does not work then try to remove armv7s also.

Please check all your frameworks are linked properly and referenced. Try to remove and add again the frameworks for that third party tool.

Please check all the frameworks are properly referenced.

In my case this worked for me.

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

Hope it helps you.

Manthan
  • 3,856
  • 1
  • 27
  • 58
  • If you import it somewhere in your project and if it is properly referenced then it will give you no error.If yes, then delete the frameworks which causes this error and add again. – Manthan Sep 25 '14 at 11:22
  • It seems working. I have removed and then added my plugins. It reduced from 15 to 9 errors. I am not expert in XCode. Please explain me how to reference the third party framework. Where and how? – Prabakaran Raja Sep 25 '14 at 11:55
  • Click on your project, Build phases, link binary with libraries and add the required framework needed. – Manthan Sep 25 '14 at 12:41
  • @PrabakaranRaja:If my answer was useful to you then please upvote for it and accept the answer if it satisfied your needs buddy. – Manthan Sep 26 '14 at 09:58
  • I can just upvote. It didnt solved my issue. I have downgraded back to Xcode 5.1 to resolve this – Prabakaran Raja Sep 26 '14 at 10:00
  • This problems come because of the architecture problem also. – Manthan Sep 26 '14 at 10:01
4

I found the solution, isn't a monkey patch, its a correction of the project. What we need to do its to change the architectures supported by the application:

  1. Go to Project -> Build Settings (check to see "all") -> Architectures -> Standard architectures (armv7 armv7s arm64)
  2. Go to Cordoba lib project -> Build Settings (check to see "all") -> Architectures:
    • Open the Debug tree and remove all elements inside them
    • Open the Release tree and do the same
  3. Go to Cordoba lib project (select target this time) and do the same of the step 2

See the youtube video for detailed information.

norman784
  • 2,201
  • 3
  • 24
  • 31
1

You can remove 64bit support as Manthan said, but for app store compliance (starting 1 February 2015) you do need it. I would suggest starting the process of updating all your Frameworks etc. to versions which do support 64bit.

From what I have seen and experienced, using Cocoapods is the easiest route to follow as it is really easy to control your framework version and update as well as downgrade to other versions. I would suggest finding out what your current versions of frameworks are and slowly updating them from there, until you find a version with 64 bit support which works with your current build.

Another method that I have found which usually fixes mach-o errors are the following:

  • Make sure that Target => Architectures => Build Active Architectures is set to NO.
  • Make sure Target => Search Paths => Framework search paths, and Library search paths has $(inherited) as their first entry.

Converting to 64bit can be a really daunting task, but will probably be worth it in the long run.

Smashing
  • 1,640
  • 18
  • 16
0

I got the same issue when I imported some git project, finally found the solution in changing the Development target.

go to Project->General->Development Info and change Deployment target.

adnan
  • 1
  • 2
0

I uninstalled the whole XCode 6. I updated the phonegap in my mac and reinstalled it again. Created a new phonegap project. Copied the code (www folder) into the new project. Build it. And it is working fine in XCode 6.

Sorry for the delayed reply

Prabakaran Raja
  • 720
  • 1
  • 11
  • 27