2

I'm getting the following error when I build for archive. My app builds fine for the simulator.

Ld "/Users/me/Library/Developer/Xcode/DerivedData/ProjectName-gflmmwtgzbpnsacgrofxwujnipkm/ArchiveIntermediates/app_core/InstallationBuildProductsLocation/Applications/ProjectName.app/ProjectName" normal armv7
    cd /Users/me/Documents/pn-core-iphone-app
    setenv IPHONEOS_DEPLOYMENT_TARGET 4.0
    setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang++ -arch armv7 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -L/Users/me/Library/Developer/Xcode/DerivedData/ProjectName-gflmmwtgzbpnsacgrofxwujnipkm/ArchiveIntermediates/app_core/BuildProductsPath/Adhoc_Distro-iphoneos -L/Users/me/Documents/pn-core-iphone-app/External/OAuthConsumer -F/Users/me/Library/Developer/Xcode/DerivedData/ProjectName-gflmmwtgzbpnsacgrofxwujnipkm/ArchiveIntermediates/app_core/BuildProductsPath/Adhoc_Distro-iphoneos -F/Users/me/Documents/pn-core-iphone-app/External/GHUnit -filelist "/Users/me/Library/Developer/Xcode/DerivedData/ProjectName-gflmmwtgzbpnsacgrofxwujnipkm/ArchiveIntermediates/app_core/IntermediateBuildFilesPath/ProjectName.build/Adhoc_Distro-iphoneos/app_core.build/Objects-normal/armv7/ProjectName.LinkFileList" -dead_strip -ObjC -liconv.2 -lxml2 -miphoneos-version-min=4.0 /Users/me/Library/Developer/Xcode/DerivedData/ProjectName-gflmmwtgzbpnsacgrofxwujnipkm/ArchiveIntermediates/app_core/BuildProductsPath/Release-iphoneos/libThree20.a -lThree20Core -lThree20Network -lThree20Style -lThree20UI -lThree20UICommon -lThree20UINavigator -framework Foundation -framework UIKit -framework CoreGraphics -framework CoreLocation -framework SystemConfiguration -framework MapKit -framework CFNetwork -weak_framework AVFoundation -framework MessageUI -framework Security -weak_framework CoreVideo -weak_framework CoreMedia -framework QuartzCore -framework AudioToolbox -framework MobileCoreServices -lz.1.1.3 -weak_framework CoreTelephony -lOAuth -liconv /Users/me/Library/Developer/Xcode/DerivedData/ProjectName-gflmmwtgzbpnsacgrofxwujnipkm/ArchiveIntermediates/app_core/BuildProductsPath/Release-iphoneos/libZXingWidget.a -framework AddressBook -framework AddressBookUI -o "/Users/me/Library/Developer/Xcode/DerivedData/ProjectName-gflmmwtgzbpnsacgrofxwujnipkm/ArchiveIntermediates/app_core/InstallationBuildProductsLocation/Applications/ProjectName.app/ProjectName"

ld: library not found for -lThree20Core
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang++ failed with exit code 1

I guess I just don't know enough about clang and build commands in general. Does the derived path that appears just before the -lThree20Core look funny to someone who can read this command? (I would have thought that should have a -L in front of it or something.)

I have verified my header search paths are correct as per this blog post http://www.amirnaor.com/?p=112, but I added the three20 project after the project was updated, so that doesn't seem to be the problem anyway.

Anyone know what the problem could be here?

livingtech
  • 3,570
  • 29
  • 42

1 Answers1

0

If you app doesn't build for running with Xcode on real device either, then it means your Three20Core library doesn't have binary data for processors on iOS devices only for the Mac processor. If you find the libThree20Core.a file or what every it is called and then in the 'terminal app' type

> file <path-to-binary>/libThree20Core.a

you should see something like this

<path-to-binary>/libThree20Core.a (for architecture armv6): current ar archive random library
<path-to-binary>/libThree20Core.a (for architecture armv7): current ar archive random library
<path-to-binary>/libThree20Core.a (for architecture i386):  current ar archive random library

if you are building the libThree20Core.a yourself you will need to create a version for all three architectures. I haven't worked out how to do this completely in Xcode, you only seem to be able to target, the Mac processor or the iOS processor not both. What you can do is build the library twice once for Mac and once for iOS. You can them merge the two into a single .a file using the libo command line tool

> lipo -create -output libThree20Core.a libThree20Core_x86.a libThree20Core_arm.a

You could alternatively try set up Xcode to use different libraries search paths depending on the target architecture.

Nathan Day
  • 5,981
  • 2
  • 24
  • 40
  • It's unfortunately been long enough that this answer is completely untestable by me now. I did eventually get the app to compile for both, but I tried so many things that I have no idea what I did that fixed the problem. As the only answer, yours gets the checkmark! – livingtech Mar 20 '12 at 21:09