Building an archive for XCode 4.6 release with pho

2019-01-16 05:43发布

问题:

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 its 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 its something else.

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

Thanks, john


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?

回答1:

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


回答2:

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".