Issue with "Undefined symbols for architecture i386"

5.4k Views Asked by At

We're having an android/ios app which was building ok up to this moment in Xcode. On monday we upgraded Xcode to Version 6.1.1. Since then I can't build and run our app in Xcode simulators.

ld: warning: ignoring file /Users/ACCOUNTZ/Library/Developer/Xcode/DerivedData/Accountz-crbaoextdggovrahxqcivilxfgeh/Build/Products/Debug-iphonesimulator/libCordova.a, file was built for archive which is not the architecture being linked (i386): /Users/ACCOUNTZ/Library/Developer/Xcode/DerivedData/Accountz-crbaoextdggovrahxqcivilxfgeh/Build/Products/Debug-iphonesimulator/libCordova.a
Undefined symbols for architecture i386:
  "_CDVLocalNotification", referenced from:
      -[AppDelegate application:didReceiveLocalNotification:] in AppDelegate.o
  "_CDVPluginHandleOpenURLNotification", referenced from:
      -[AppDelegate application:openURL:sourceApplication:annotation:] in AppDelegate.o
      -[CDVInAppBrowser openInSystem:] in CDVInAppBrowser.o
      -[AppDelegate application:openURL:sourceApplication:annotation:] in AppDelegate.o
      -[CDVInAppBrowser openInSystem:] in CDVInAppBrowser.o
  "_CDVRemoteNotification", referenced from:
      -[AppDelegate application:didRegisterForRemoteNotificationsWithDeviceToken:] in AppDelegate.o
  "_CDVRemoteNotificationError", referenced from:
      -[AppDelegate application:didFailToRegisterForRemoteNotificationsWithError:] 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_CLASS_$_CDVPlugin", referenced from:
      _OBJC_CLASS_$_GAPlugin in GAPlugin.o
      _OBJC_CLASS_$_CDVClipboard in CDVClipboard.o
      _OBJC_CLASS_$_CDVDevice in CDVDevice.o
      _OBJC_CLASS_$_CDVInAppBrowser in CDVInAppBrowser.o
      _OBJC_CLASS_$_CDVConnection in CDVConnection.o
  "_OBJC_CLASS_$_CDVPluginResult", referenced from:
      objc-class-ref in GAPlugin.o
      objc-class-ref in CDVClipboard.o
      objc-class-ref in CDVDevice.o
      objc-class-ref in CDVInAppBrowser.o
      objc-class-ref in CDVConnection.o
  "_OBJC_CLASS_$_CDVUserAgentUtil", referenced from:
      objc-class-ref in CDVInAppBrowser.o
  "_OBJC_CLASS_$_CDVViewController", referenced from:
      _OBJC_CLASS_$_MainViewController in MainViewController.o
      objc-class-ref in CDVDevice.o
  "_OBJC_CLASS_$_CDVWebViewDelegate", referenced from:
      objc-class-ref in CDVInAppBrowser.o
  "_OBJC_METACLASS_$_CDVCommandDelegateImpl", referenced from:
      _OBJC_METACLASS_$_MainCommandDelegate in MainViewController.o
  "_OBJC_METACLASS_$_CDVCommandQueue", referenced from:
      _OBJC_METACLASS_$_MainCommandQueue in MainViewController.o
  "_OBJC_METACLASS_$_CDVPlugin", referenced from:
      _OBJC_METACLASS_$_GAPlugin in GAPlugin.o
      _OBJC_METACLASS_$_CDVClipboard in CDVClipboard.o
      _OBJC_METACLASS_$_CDVDevice in CDVDevice.o
      _OBJC_METACLASS_$_CDVInAppBrowser in CDVInAppBrowser.o
      _OBJC_METACLASS_$_CDVConnection in CDVConnection.o
  "_OBJC_METACLASS_$_CDVViewController", referenced from:
      _OBJC_METACLASS_$_MainViewController in MainViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)   

I spent few hours already to figure out what is going on, but it seems to be out of my reach. I did followed many suggestions found on web, but with no result. I tried to add "missing" frameworks from within Build Phases section, I played with "Build Active Architectures Only", I tried to add this i386 architecture to list of valid architectures for both Target and Project.
All these to no effect.

What am I missing here?

1

There are 1 best solutions below

0
On BEST ANSWER

So it turned out that, I had a missing architecture (i386) for Cordova build of my application. My "cordova.a file was ignored" (as per my warning), because in fact I've lost i386 architecture setting after Xcode upgrade. To resolve this I needed to add this architecture by clicking Cordova.xcodeproj file. Then I get to Cordova (not Project) build settings where I had to add my missing architecture for both Target and Project part of Cordova Build.

I wasn't even aware of this section exists. So I tried many times to adjust architectures on my Project itself (by clicking on the project name in Navigator and accessing build settings tab), but to fix my issue, I just had to do this same by clicking Cordova.xcodeproj file instead.

This link helped me out, so you might want to follow too.