19

Can you plz help me? I am using XCode version 4.6.3 and phonegap version 2.9. The project is running fine in Simulator but when I want to make a IPA file, it always build failed.

The message is showing like below:

file not found: /Users/admin/.../libCordova.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have found some discussion on this issue. Most of the solution is like (1) to change the BUILD ACTIVE ARCHITECTURE ONLY to YES, (2) to change the ARCHITECTURE only to armv7, (3) update the project after creating it...etc. But none of those working for me.

Plz help anyway.

Thanks in advance.

Mehdi
  • 540
  • 1
  • 11
  • 28

5 Answers5

41

Follow these steps to fix this problem:

  1. Go to project settings and Build Tab. Search for "Other Linker Flags"
  2. Double click on the linker flags for Release and Change ${TARGET_BUILD_DIR}/libCordova.a to ${BUILT_PRODUCTS_DIR}/libCordova.a
  3. Do the same for Debug
  4. Clean and build archive again
Paolo Stefan
  • 10,112
  • 5
  • 45
  • 64
Prem
  • 426
  • 5
  • 2
  • Thanks Paolo. I've tested a lot of solutions, but only this got rid of the problem. – Alessandro Oct 28 '13 at 14:41
  • most important post I read all week. Should be on the phonegap website! – Jon Nov 01 '13 at 12:28
  • In my case, this was already set with a Cordova 3.4 project running in XCode 5.1. However, the libCordova.a shows red under the "Linked frameworks and Libraries" section of my project. The project builds properly still so I'm assuming this must be innocuous. – occasl May 16 '14 at 17:08
1

If Prems answer doesn't fix the issue, try building your CordovaLib project first. After doing that I was able to build my project.

Chris
  • 4,403
  • 4
  • 42
  • 54
1

In addition to several other suggestions & post, I found that I was experiencing this problem on my AdHoc builds only.

The problem for me was the the CordovaLib subproject did not have an AdHoc configuration. Once I added an "AdHoc" configuration to the CordovaLib subproject, this started working.

enter image description here

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

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

If you check the linker suggestion above and still not working. Make sure that Cordova project has the same configuration name. If your main project has "Debug, Release, and Production" configurations. Add same configurations in the Cordova project. Build Cordova and then build your project.

maridob
  • 651
  • 6
  • 22
-1

I you are using Xcode 5.0, do exactly the opposite and it works.

  • Orion, on my case the XCode 5 + BUILT_PRODUCTS_DIR solution is ok. – Alessandro Oct 28 '13 at 14:42
  • 5
    I'm using Xcode 5.0 and default value is already ${BUILT_PRODUCTS_DIR}/libCordova.a so your solution doesn't work, also I tried @orioncabbar 's answer it doesnt work either. Also quotes "" added on default value? – Mehmet Uyarovic Feb 10 '14 at 01:37