在Xcode 4.2中构建存档时,有三个相关的clang链接错误

时间:2011-10-31 16:47:40

标签: iphone objective-c three20 clang

我在构建存档时遇到以下错误。我的应用程序适用于模拟器。

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

我想我对clang和构建命令一般都不太了解。在-lThree20Core之前出现的派生路径对于能够读取此命令的人来说看起来很有趣吗? (我原本以为它应该在它前面有一个-L。)

我已根据此博文http://www.amirnaor.com/?p=112验证了我的标题搜索路径是否正确,但我在项目更新后添加了three20项目,因此无论如何这似乎都不是问题。

任何人都知道问题可能在这里?

1 个答案:

答案 0 :(得分:0)

如果您的应用程序不构建为在真实设备上使用Xcode运行,那么这意味着您的Three20Core库不具有仅适用于Mac处理器的iOS设备上的处理器的二进制数据。如果您找到 libThree20Core.a 文件或其中的每个文件,然后在“终端应用”中输入

> file <path-to-binary>/libThree20Core.a
你应该看到类似的东西

<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

如果您自己构建 libThree20Core.a ,则需要为所有三种体系结构创建一个版本。我还没有弄清楚如何在Xcode中完全做到这一点,你似乎只能瞄准,Mac处理器或iOS处理器,而不是两者兼而有之。你可以做的是为Mac构建两次库,为iOS构建一次。您可以使用 libo 命令行工具将两者合并为一个.a文件

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

您也可以尝试设置Xcode以使用不同的库搜索路径,具体取决于目标架构。