28

clang: error: no such file or directory: '/Users/admin/Library/Developer/Xcode/DerivedData/__TESTING__-fzbkvdbnndieeagphtjhdndiyttl/Build/Products/Debug-iphoneos/libCordova.a'

How do I get this a missing libCordova.a ?

align top
(source: kerrydeaf.com)

UPDATE: For Simon Germain. align top

UPDATE: For Simon Germain. I don't see "Identity and Type". I can see "Identity". I'm using xcode 4.5 align top
(source: kerrydeaf.com)

align top

UPDATE: For Simon Germain. I got the Identity.

align top
(source: kerrydeaf.com)

UPDATE: For Samuel

align top
(source: kerrydeaf.com)

UPDATE: For Simon Germain - Architecture.

UPDATE: For james0n - armv.

align top
(source: kerrydeaf.com)

UPDATE: For Simon Germain - Architecture.

UPDATE: For james0n - armv.

 Undefined symbols for architecture i386:
   "_OBJC_CLASS_$_CDVURLProtocol", referenced from:
       objc-class-ref in AppDelegate.o
   "_OBJC_CLASS_$_CDVViewController", referenced from:
       _OBJC_CLASS_$_MainViewController in MainViewController.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)

UPDATE: For james0n - Valid Architecture.

align top
(source: kerrydeaf.com)

UPDATE: It is now solved!!! make sure all armv7 and armv7s for ios 6 on all in xcode. It worked.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Irishgirl
  • 751
  • 3
  • 14
  • 22

12 Answers12

18

For your project, set the build setting "Build Active Architecture Only" to yes.

(Maybe also set the the Architectures build setting to "Standard (armv7, armv7s)" for CordovaLib project.)

james0n
  • 586
  • 3
  • 15
  • Yes I did both. Still the same "Undefined symbols for architecture i386:" as above screen grab. – Irishgirl Oct 04 '12 at 11:11
  • Seems like it's still trying to build for architecture i386, when it shouldn't. Have you tried cleaning and rebuilding? Besides checking the "Valid architectures", is i386 listed in the "Architectures" setting for CordovaLib project? – james0n Oct 04 '12 at 12:02
  • I've tried cleaning and rebuilding, but no. Yes I see i386 armv6 armv7 on Valid Architecture. What should I do? To get rid of 1386. – Irishgirl Oct 04 '12 at 13:39
  • I suppose you don't need i386 there and the build issue seems i386 specific, so double click on it and remove it from the valid architectures. – james0n Oct 04 '12 at 14:08
  • So, I'll just use "armv7" or "armv7, armv7s" instead? and then remove "i386 armv6 armv7" from Valid Architecture? – Irishgirl Oct 04 '12 at 14:10
  • armv7, armv7s for now, just remove i386. Basically removing i386 shouldn't make a difference, as it's not listed in the Architectures either. Still the linker error is i386 specific, so you might give this a shot. – james0n Oct 04 '12 at 14:23
  • Yes, it is still: "Undefined symbols for architecture i386". What about Build Active Architecture Only Yes or NO. – Irishgirl Oct 04 '12 at 14:37
  • Try YES. You'd want to avoid i386, if that's causing issues. But that should have been gone already.. – james0n Oct 05 '12 at 06:49
  • Build Active Architecture = Yes fixed my build. In Architectures - armv6 armv7 – Madman Oct 05 '12 at 16:16
  • Are you using iOS 5 or 6? I've read this post that armv6 are for 3G. I'm not targeting or aiming for 3G. Is it iphone 4, 4s and 5. Therefore, there is no need for armv6 for iOS? – Irishgirl Oct 07 '12 at 11:49
9

Had (as many others) the same problem, here's what I did:

  1. Redid the Getting Started guide from Phonegap (including downloading and extracting the source again)
  2. Same problem with the HelloWorld app
  3. product - clean
  4. Changed both the 'HelloWorld' and 'CordovaLib'-project (so not the Targets) according to james0n's answer, settings:

Architectures: Standard (armv7, armv7s)

Build Active Architecture only: Yes

and then it magically worked, I think steps 3 and 4 did it however.

Community
  • 1
  • 1
andy
  • 531
  • 5
  • 16
  • Ok. Before I start again. What do i do with bin and CordovaLib from Phonegap 2.1 folder that I've downloaded from Phonegap? I know that I've to drag a bin on to my desktop? What about CordovaLib? Do I suppose to leave it alone and allow Therminal to do the work? Or drag both bin and CordovaLib on to my laptop somewhere? I've created so far in Theminal but stop short of upgrade. – Irishgirl Oct 08 '12 at 08:50
4

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
  • There is no armv6 on xcode 4.5 as far I can see? See as above screen grab. It read: Standard (armv7, armv7s) – Irishgirl Oct 04 '12 at 00:49
  • OK, I see your screenshot for CordovaLib, and I imagine it's the same for YourProject... Sorry if it didn't work. I had the same error message, and removing armv6 solve it. – Samuel Oct 04 '12 at 16:51
  • Is it xcode 4.5 and phonegap 2.0 you're talking about? or it xcode 4.5 and Phonegap 2.1? – Irishgirl Oct 04 '12 at 16:59
  • latest version : xCode 4.5 and Phonegap 2.1 – Samuel Oct 05 '12 at 15:36
4

I had the same problem as you, worked fine deployed to the simulators but not to a device. Neither of the suggested answers worked for me.

Here's what did work for me:

Set deployment target to v4.3 and on the project settings for the CordovaLib project, set the Build Active Architecture Only to Yes. (Not needed on your main project).
Important, do a Product-> Clean and rebuild.

Magnus Johansson
  • 28,010
  • 19
  • 106
  • 164
3

Make sure that the CordovaLib's product's target is set to "Relative to Built Product" on the right hand-side panel, first tab on theleft, under "Identity and Type".

enter image description here

Simon Germain
  • 6,834
  • 1
  • 27
  • 42
  • I'm not sure what you're trying to say. I've included a screen grab as above to illustrate a point. Are you talking about the xcode "Identity" on very top / right that reads with a "Project Name" under "Identity"? – Irishgirl Oct 03 '12 at 21:37
  • See screen grab as above: I don't see "Identity and Type". I can see "Identity". I'm using xcode 4.5 – Irishgirl Oct 03 '12 at 22:03
  • You need to open the CordovaLib project, in the "Product" directory, you should see a `libCordova.a` file (it could be red). Click on it and you should see what I showed you on the screenshot. – Simon Germain Oct 03 '12 at 22:57
  • Yes. see screen grab as top. I got the "Identity". But not "Identity and Type". At least, CordovaLib's product's target is set to "Relative to Built Product". – Irishgirl Oct 04 '12 at 01:37
  • May I ask why set - CordovaLib's product's target is set to "Relative to Built Product"? For what reason? – Irishgirl Oct 04 '12 at 01:37
  • So the library ends up in the same build directory as the main project for linking. – Simon Germain Oct 04 '12 at 02:04
  • I still get errors. Now, it is double dutch for me to read. See screen grab as above of Architecture. – Irishgirl Oct 04 '12 at 02:40
1

Download the Cordova installer from here http://phonegap.com/download. Make sure it is the same version that you are currently using (ex 2.0).

Then mount the dmg found in the ios directory.

Then run the .pkg installer.

Restart Xcode.

Vinnie
  • 1,670
  • 14
  • 16
  • Yes, I've downloaded phonegap 2.0 last week and installed a nightmare-ish phonegap 2.0 using terminal.app I'm not going to repeat it. – Irishgirl Oct 03 '12 at 21:16
  • I'm saying it has to be re-done. Not everything, just the step I mentioned. No terminal needed, it's a GUI installer. It doesn't replace or do anything damaging either. The ios folder is in the lib folder. – Vinnie Oct 03 '12 at 21:19
  • I've already installed as per instruction. But no luck. Still missing libCordova.a – Irishgirl Oct 03 '12 at 22:12
  • Try deleting and then re-adding the CordovaLib xcode project. It should be in your Documents/CordovaLib directory. – Vinnie Oct 04 '12 at 13:13
  • Ok, if I do that and which CordovaLib do I source from to re-add or do I re-add from a same one that I delete? – Irishgirl Oct 04 '12 at 15:09
  • I think they are one and the same. When I look at my CordovaLib project, it is from the Documents directory. Deleting/re-adding is from the same location. – Vinnie Oct 05 '12 at 13:19
1

You gotta run the update script, I know it might be a pain in the butt to do it, but that's what it takes.

Download and open the Phonegap 2.1 package from the official site. Open a terminal window, and cd to the installation directory

You'll need to first create a new project:

./create [project_folder_path] [package_name] [project_name]

Then you need to set the path to your libraries.

/update_cordova_subproject [xcodeproj file]

Now open up your project and set the deployment target to 4.3 and you should be ready to go. Hope that helps

EDIT:

This is how my configuration looks like for CordovaLib Project

enter image description here

ILikeTacos
  • 17,464
  • 20
  • 58
  • 88
  • Ok, how do you know by grading to Phonegap 2.1 will solve it? – Irishgirl Oct 04 '12 at 16:55
  • because I just ran into this issue an hour ago, and I already solved it. You need to select CordovaLib Project and change the architecture to the standard one, it will pass. Took me a while to figure it out. Don't forget to clean the project before testing. – ILikeTacos Oct 04 '12 at 16:59
  • Ok I'll upgrade to Phonegap 2.1 later. – Irishgirl Oct 04 '12 at 17:22
  • Where do I put CordovaLib? Do I leave it alone in the Phonegap 2.1 folder that come with it or drag/drop it in my Documents? Please advise? Got as far as ./create ~/admin/medicine com.helloworld Hello World – Irishgirl Oct 05 '12 at 15:39
  • Saw this link: http://zsprawl.com/iOS/2012/10/installing-cordovaphonegap-2-1-for-ios/ and its very good but the sang is where do I put CordovaLib? – Irishgirl Oct 05 '12 at 15:41
  • Manged to ./create ~/admin/medicine com.medicine medicine and it worked. But when I typed in /update_cordova_subproject medicine.xcodeproj I get "no such file or directory". Tried this where a xcode project file is located. I tried a project folder and directory path /update_cordova_subproject ~/admin/medicine/medicine.xcodeproj No luck either!! – Irishgirl Oct 05 '12 at 16:28
1

Also - make sure you don't have more than one PhoneGap Xcode project open at a time - I was getting conflicts between the two. "Workspace already open in another workspace" type of loop.

dijipiji
  • 3,063
  • 1
  • 26
  • 21
  • How does that work as I've one www folder to work with on xcode. That is a prediction with phonegap when ./create a project on Therminal.app and Therminal.app have a bad habit of throwing in a new project within project. It creates an error if I'm upgrading through Therminal.app /upgrade "No file or directory can be found". Would that be the cause of a problem of all this time? Maybe if I clear out all the existing project and start from scratch? (I'll back up my current project before I attempt anything). – Irishgirl Oct 09 '12 at 11:30
1

After spending many hours with even more errors, here's what worked for me. Basically combining much of the above:

  1. Start with a fresh copy of Cordova. If you've been messing with it like me, it's not fresh anymore.
  2. Move the Cordova files out of the download directory (I tend to clean that directory now and then...)
  3. Create a new project as described in the Phonegap docs, i.e. drag the ios/bin folder to the Terminal icon and run the create script in Terminal. No need to run the update_cordova_subproject script.
  4. Open the project in XCode.
  5. For your product, set the iOS Deployment Target to 4.3 (I did it 2x, both in Project and Target Build Settings).
  6. For CordovaLib.xcodeproj, set Build for Active Architecture to Yes in the Project Build Settings.
  7. Clean and run.

Do not include armv7s in any of the architecture lists, as it will not build for device.

Tested in simulator and on an iPad with iOS 6. Using Phonegap 2.1.0 and XCode 4.5.1.

Update: if you want to support iPhone 5, you will need armv7s. It requires the fix in https://issues.apache.org/jira/browse/CB-1360 , which will be in Cordova 2.2.0. (Haven't tried it yet, working on an iPad project.)

RonaldPK
  • 760
  • 4
  • 18
1

I fixed this by removing the armv6 and i386 architecture from Valid Architecture setting

gheese
  • 1,170
  • 1
  • 11
  • 17
0

I had this problem too. I think it was because I had previously installed an old version of phone gap that installed some stuff in xcode. I uninstalled, then reinstalled xcode. Then I ran the Uninstall Cordova.applescript that came with phone gap. This fixed the problem of the red libCordova.a

Tom Kincaid
  • 4,887
  • 6
  • 47
  • 72
0

In addition to several other suggestions & post, I found that I was experiencing this problem on my AdHoc builds only. Please note that I figured this out during debugging because if I set the Edit Scheme > Archive build configuration to "release" it would work OK, but if set to AdHoc it would give me a link error, telling me that this file could not be found:

/Users/jason/Library/Developer/Xcode/DerivedData/MommyNearest-ceourmykvgxdekbkmzenuvhcfnzk/Build/Intermediates/ArchiveIntermediates/MommyNearest/BuildProductsPath/Adhoc-iphoneos/libCordova.a

This was actually a good clue to what the problem was, which was that somehow the CordovaLib subproject did not have an AdHoc configuration (it had ONLY "Debug" and "Release" configurations).

Therefore, when building for an AdHoc release (to use with Testflight) it would not create a symlink for this file correctly. Once I added an "AdHoc" configuration to the CordovaLib subproject, this started working.

enter image description here

Jason FB
  • 4,752
  • 3
  • 38
  • 69