32

I am getting an error after creating a new Cordova 2.1.0 project and updating the www folder with some code from a previous PhoneGap application.

clang: error: no such file or directory: '/Users/peterbanjo/Library/Developer/Xcode/DerivedData/OpuzMobile-bhwawiqfaptmxvfosawfabudgbkj/Build/Products/Debug-iphoneos/libCordova.a'

The error only occurs when I try and run the application on a device - in the simulator it works fine.

I am running Xcode 4.5 and iOS6 on the target iPad. I have tried a clean build and libCordova.a appears in the Build Phases > Link Library With Libraries tab but it is in red.

Peter
  • 4,493
  • 6
  • 41
  • 64

8 Answers8

43

What I found confusing with PhoneGap/Cordova 2.1.0 by upgrading from 1.4 is that there are TWO projects in my application. There is MyApplication.xcodeproj and CordovaLib.xcodeproj. The changes to resolve this issue need to be applied to the CordovaLib project.

  • Change "Build Active Architecture Only" to "YES"
  • Update the text file project.pbxproj to these values
  • Toggle between the build schema for the simulator and the device (Use the select menu next to the stop button. Somehow this seems to cause the changes to be detected).

Did this work for you? Did I miss something?

PS: For a better understanding of the problem take a look at this Google Forum thread

Peter
  • 4,493
  • 6
  • 41
  • 64
  • 7
    The change "Build Active architecture only" to YES solved my issue. Thanks. – Alain Sep 28 '12 at 14:25
  • 4
    Changing "Build Active Architecture Only" to Yes worked for me also. Here's [screenshot](http://cl.ly/image/0f022Y1i141J) of where that setting is. – Jonathan Stark Sep 28 '12 at 18:56
  • @Jonathan - thanks for adding the screenshot. It's sometimes tricky getting around Xcode – Peter Sep 30 '12 at 16:46
  • I too only needed to change "Build Active architecture only" to YES, then it ran fine on my device. Thanks! – Todd Price Oct 01 '12 at 04:02
  • FYI - Changing "Build Active Architecture Only" to YES stopped working reliably for me. In fact, this bug is really unpredictable. I worked through the google forum thread above and made a screencast of how to implement a fix that I found there. Seems to be working reliably for me (so far, anyway): http://www.youtube.com/watch?v=qNgcDioEBV8 – Jonathan Stark Oct 03 '12 at 19:48
  • @JonathanStark thanks for the updates. it seems to be working for me so far but i am having memory issues with ios6 now – Peter Oct 05 '12 at 08:31
  • The Architectures in the default project show armv6 and armv7. Xcode 4.5 onwards [does not build armv6](http://www.cocos2d-iphone.org/forum/topic/39570). – PAT Oct 25 '12 at 14:53
  • This worked for me. However, I had to select "Levels" near the top of the screen. The "Combined" view did not show the setting. – Ryan Wheale Jul 04 '13 at 19:07
16

I'm using Cordova/Phonegap 2.9 and this solved my issue. Didn't touch any of the arch stuff. Everything is set to armv7 armv7s on mine.

Follow these steps to fix this problem:

  1. Go to project settings and Build Tab.
  2. Search for "Other Linker Flags"
  3. Double click on the linker flags for Release and Change ${TARGET_BUILD_DIR}/libCordova.a to ${BUILT_PRODUCTS_DIR}/libCordova.a
  4. Do the same for Debug Clean and build archive again
Dev01
  • 13,292
  • 19
  • 70
  • 124
  • 3
    I'd tried a lot of different techniques and I've seen this one mentioned elsewhere, but this time it not only made sense to me, but it also worked (with PhoneGap 2.9.0)! Thanks @WootWoot http://screencast.com/t/PvEQfmogsffd – zeroasterisk Sep 12 '13 at 18:01
  • @zeroasterisk Thanks for the screenshot! The order from that list is important so moving the lines around (like I did) is not a smart move – Ungureanu Liviu Feb 11 '15 at 14:11
6

I had the same error and fixed it by reverting to an older version of cordova ios.

Steps to fix the issue:

  1. Uninstall cordova-ios first, with npm uninstall cordova-ios
  2. Install old version of cordova-ios with npm install cordova-ios@4.4.0
  3. Remove existing ios platform with ionic cordova platform rm ios or ionic platform rm ios
  4. After that we should add platform with ionic cordova platform add ios@4.4.0 or ionic platform add ios@4.4.0
  5. Run ionic cordova build ios.

Instructions came from here.

j.davies
  • 2,321
  • 1
  • 19
  • 24
3

Only need to remove armv6 from both YourProject and CordovaLib: remove armv6 from CordovaLib and do the same for YourProject

The consequences of doing this? Apparently, it's still working on iPhone 3GS, but not the previous versions..

Samuel
  • 5,439
  • 6
  • 31
  • 43
3

To make it work I downloaded from http://connect.apple.com stand alone Xcode 4.4.1. With this version I can build my phonegap Application with armv6 :)

Yes, in this case you need to have two Xcode on your computer.

1

Look at this https://groups.google.com/forum/?fromgroups=#!topic/phonegap/ywoc9wNydZ8

works for me

-- OS X 10.8.2 XCode 4.5 iOS 6.0 PhoneGap 2.1.0

Theus
  • 11
  • 1
  • 1
    Thanks for the link - I have added it. I tried out the steps in the forum and they didn't work at first so I posted the question. I kept trying then when I understood that there were two projects and I toggled the build schemas - the error went away. I think I struggled because I was coming from such an old version of PhoneGap. But I posted the answer in case anyone else needs it - I didn't find a similar one on Stackoverflow. – Peter Sep 28 '12 at 11:41
1

DO NOT assume that having Standard (armv7,armv7s) - $(ARCHS_STANDARD_32_BIT) is the same as the fix above. Manually change this value to only armv7 and that fixed it for me. I was very frustrated.

Augie Gardner
  • 2,749
  • 3
  • 25
  • 36
0

If you did everything here and it is still not working and you have separate configuration aside from Release and Debug - for this example is Production. Make sure that 'Production' Build Configuration exists in Cordova project. Build the Cordova Project and Build + Archive your main project again.

maridob
  • 651
  • 6
  • 22