24

This appears to be a recurring phenomena.

I saw a number of prior questions, where the solution was to delete armv6, and then the archive would work. Of course, armv6 is gone.

So, now, building with both current, Xcode 4.6.3 phonegap 2.9. And yes, the app works fine on iphones, ipads, and in the simulator.

I get this message at the end of the create archive step:

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -L/Users/peeq/Library/Developer/Xcode/DerivedData/peeq-gylybvwifdxjmtajtbvdsdpjcvkl/Build/Intermediates/ArchiveIntermediates/peeq/BuildProductsPath/Release-iphoneos -F/Users/peeq/Library/Developer/Xcode/DerivedData/peeq-gylybvwifdxjmtajtbvdsdpjcvkl/Build/Intermediates/ArchiveIntermediates/peeq/BuildProductsPath/Release-iphoneos -filelist /Users/peeq/Library/Developer/Xcode/DerivedData/peeq-gylybvwifdxjmtajtbvdsdpjcvkl/Build/Intermediates/ArchiveIntermediates/peeq/IntermediateBuildFilesPath/peeq.build/Release-iphoneos/peeq.build/Objects-normal/armv7s/peeq.LinkFileList -dead_strip -weak_framework CoreFoundation -weak_framework UIKit -weak_framework AVFoundation -weak_framework CoreMedia -weak-lSystem -force_load /Users/peeq/Library/Developer/Xcode/DerivedData/peeq-gylybvwifdxjmtajtbvdsdpjcvkl/Build/Intermediates/ArchiveIntermediates/peeq/InstallationBuildProductsLocation/Applications/libCordova.a -ObjC -fobjc-link-runtime -miphoneos-version-min=5.0 -framework CoreLocation -framework ImageIO -framework OpenAL -framework AssetsLibrary /Users/peeq/Library/Developer/Xcode/DerivedData/peeq-gylybvwifdxjmtajtbvdsdpjcvkl/Build/Intermediates/ArchiveIntermediates/peeq/BuildProductsPath/Release-iphoneos/libCordova.a -framework Foundation -weak_framework UIKit -framework CoreGraphics -framework AddressBook -framework AddressBookUI -framework AudioToolbox -weak_framework AVFoundation -framework CFNetwork -framework MediaPlayer -framework QuartzCore -framework SystemConfiguration -framework MobileCoreServices -weak_framework CoreMedia -framework CoreLocation -o /Users/peeq/Library/Developer/Xcode/DerivedData/peeq-gylybvwifdxjmtajtbvdsdpjcvkl/Build/Intermediates/ArchiveIntermediates/peeq/IntermediateBuildFilesPath/peeq.build/Release-iphoneos/peeq.build/Objects-normal/armv7s/peeq

ld: file not found: /Users/peeq/Library/Developer/Xcode/DerivedData/peeq-gylybvwifdxjmtajtbvdsdpjcvkl/Build/Intermediates/ArchiveIntermediates/peeq/InstallationBuildProductsLocation/Applications/libCordova.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)

And went over and looked around the file system there:

cd /Users/peeq/Library/Developer/Xcode/DerivedData/peeq-gylybvwifdxjmtajtbvdsdpjcvkl/Build
./Intermediates/ArchiveIntermediates/peeq/BuildProductsPath/Release-iphoneos/libCordova.a
./Intermediates/ArchiveIntermediates/peeq/IntermediateBuildFilesPath/CordovaLib.build/Release-iphoneos/CordovaLib.build/Objects-normal/armv7/libCordova.a
./Intermediates/ArchiveIntermediates/peeq/IntermediateBuildFilesPath/CordovaLib.build/Release-iphoneos/CordovaLib.build/Objects-normal/armv7s/libCordova.a
./Intermediates/ArchiveIntermediates/peeq/IntermediateBuildFilesPath/UninstalledProducts/libCordova.a

And it's been built, just not put where the linker wanted to find it.

So, no doubt some build setting either tells the linker to look there, or tells the build to put it where the linker wants to find it.

Unless it's something else.

My question is how to get the app archive to build correctly, so it can go off to the store.


A fine person who works at Apple told me where to look, at which point, this was solved.

Deep within the Build Settings, there is a field to be set, called Other Linker Flags

It starts out showing no value, but if you click on it, it pops up with Debug and Release.

In the very long string that is Release, one finds a -force_load libCordova.a
and deletes that part of the string.

From:

-weak_framework CoreFoundation -weak_framework UIKit -weak_framework AVFoundation -weak_framework CoreMedia -weak-lSystem -force_load ${TARGET_BUILD_DIR}/libCordova.a -ObjC

To:

-weak_framework CoreFoundation -weak_framework UIKit -weak_framework AVFoundation -weak_framework CoreMedia -weak-lSystem  -ObjC

Its probably a bug in some fashion that phonegap defaults this in place, I shall also contact them and see if it can default repair it.

His note that pointed me at it:

I notice that your link command contains both this:

-force_load /Users/peeq/Library/Developer/Xcode/DerivedData/peeq-gylybvwifdxjmtajtbvdsdpjcvkl/Build/Intermediates/ArchiveIntermediates/peeq/InstallationBuildProductsLocation/Applications/libCordova.a

and this:

/Users/peeq/Library/Developer/Xcode/DerivedData/peeq-gylybvwifdxjmtajtbvdsdpjcvkl/Build/Intermediates/ArchiveIntermediates/peeq/BuildProductsPath/Release-iphoneos/libCordova.a

The path being passed to -force_load is the bogus path that the linker is complaining about. I think that you need to remove the “-force_load” linker flag. Do you have such a flag set in the “Other Linker Flags” setting?

Cœur
  • 37,241
  • 25
  • 195
  • 267
lekash
  • 241
  • 1
  • 2
  • 3
  • I was having the same issue and resolved it, at least for my project. Check out my answer here: http://stackoverflow.com/a/17455264/2183674 – Clark Burns Jul 03 '13 at 18:14
  • FYI we got this same thing with XCode 5.1.1 and PhoneGap 3.1. The fix at the bottom with my comment is what worked for us. – ganders Dec 04 '14 at 20:10

2 Answers2

79

Found a fix.

  1. In your Target's Build Settings, find Other Linker Flags
  2. Change $(TARGET_BUILD_DIR)/libCordova.a
  3. To $(BUILT_PRODUCTS_DIR)/libCordova.a
jperelli
  • 6,988
  • 5
  • 50
  • 85
Shazron
  • 2,446
  • 1
  • 18
  • 30
  • Thanks, solved the problem! (Kept running into old descriptions of libCordova.a problems...) – Koniak Jul 01 '13 at 16:12
  • 4
    THANK YOU!!! why cordova always have these problem..every xcode release and evey phonegap release just headaches!! THANK YOU!! – Francesco Jul 08 '13 at 18:57
  • This saved me some serious head banging against the table. Thank you!! – Ian Jul 31 '13 at 11:13
  • `Other Linker Flags` resides under "Linking" and contains multiple values but you can click "multiple values" and the part you need to edit is on it's own line: http://imgur.com/1n4VSUa – inorganik Aug 13 '13 at 15:26
  • 1
    I don't know whether I should blame Apple or Cordova. But IMHO, while it pleases the end users, Apple always beat the cra* out of the devs – Jay Mayu Aug 15 '13 at 08:57
  • Just also wanted to be one to say THANK YOU. What a chore it was just to get a working IPA out of this mess... THANKS AGAIN! – Eric Nov 04 '13 at 21:47
  • Yeah, upgrading phonegap library is just so freaking difficult with all the build errors. –  Feb 13 '14 at 08:25
4

It's does not works for me to change to "$(BUILT_PRODUCTS_DIR)/libCordova.a" in "Other Linker Flags". The problem still exist. (Xcode 4.6.3 phonegap 2.9.0)

So, I try the setting below and it works for me.

  1. In your Target's Build Settings, find "Other Linker Flags"
  2. Delete "$(TARGET_BUILD_DIR)/libCordova.a"
  3. Change "-force_load" to "-all_load"

This did the trick for me.

======== Update ============

With the above trick, I can achieve the app and submit to App Store with no issue. But I found out in the iTune Connect that it shows "Invalid binary".