XCode 中的 Clang 错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12518579/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Clang Error in XCode
提问by nate8684
My app had worked well in xcode 4.4.1, but I just updated to 4.5 and am now getting a clang error. Not even sure what it is telling, has anyone experienced this before or can shed light into how I go about fixing it? here is the exact error:
我的应用程序在 xcode 4.4.1 中运行良好,但我刚刚更新到 4.5,现在出现了一个叮当声错误。甚至不确定它在说什么,有没有人以前经历过这种情况,或者可以阐明我如何修复它?这是确切的错误:
Ld /Users/natehamilton/Library/Developer/Xcode/DerivedData/LCBCChurch-hacgcivdmhbavlecueatfvjbekxn/Build/Intermediates/LCBCChurch.build/Debug-iphoneos/LCBCChurch.build/Objects-normal/armv7s/LCBCChurch normal armv7s
cd "/Users/natehamilton/Desktop/Current Projects/Work/Projects/Mobile App/LCBCChurch"
setenv IPHONEOS_DEPLOYMENT_TARGET 5.1
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/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.0.sdk -L/Users/natehamilton/Library/Developer/Xcode/DerivedData/LCBCChurch-hacgcivdmhbavlecueatfvjbekxn/Build/Products/Debug-iphoneos -F/Users/natehamilton/Library/Developer/Xcode/DerivedData/LCBCChurch-hacgcivdmhbavlecueatfvjbekxn/Build/Products/Debug-iphoneos -F/Users/Shared/Cordova/Frameworks -filelist /Users/natehamilton/Library/Developer/Xcode/DerivedData/LCBCChurch-hacgcivdmhbavlecueatfvjbekxn/Build/Intermediates/LCBCChurch.build/Debug-iphoneos/LCBCChurch.build/Objects-normal/armv7s/LCBCChurch.LinkFileList -dead_strip -weak_framework UIKit -weak_framework AVFoundation -weak_framework CoreMedia -weak_library /usr/lib/libSystem.B.dylib -fobjc-link-runtime -miphoneos-version-min=5.1 -framework Foundation -framework UIKit -framework CoreGraphics -framework AddressBook -framework AddressBookUI -framework AudioToolbox -framework AVFoundation -framework CoreLocation -framework MediaPlayer -framework QuartzCore -framework SystemConfiguration -framework MobileCoreServices -framework CoreMedia -framework Cordova -o /Users/natehamilton/Library/Developer/Xcode/DerivedData/LCBCChurch-hacgcivdmhbavlecueatfvjbekxn/Build/Intermediates/LCBCChurch.build/Debug-iphoneos/LCBCChurch.build/Objects-normal/armv7s/LCBCChurch
ld: file is universal (3 slices) but does not contain a(n) armv7s slice: /Users/Shared/Cordova/Frameworks/Cordova.framework/Cordova for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
回答by
Change "Build Active Architecure Only" to Yes, and it will work :) cheers!
将“仅构建活动架构”更改为是,它将起作用:) 欢呼!
回答by Tim
The armv7s
architecture is the new processor type used in the iPhone 5. It looks like your Cordova framework hasn't yet been updated to support that new processor, so when clang goes to link Cordova into your application for iPhone 5 binaries, it can't do so successfully. You'll need to get an update for Cordova.
该armv7s
架构是 iPhone 5 中使用的新处理器类型。看起来您的 Cordova 框架尚未更新以支持该新处理器,因此当 clang 将 Cordova 链接到您的 iPhone 5 二进制文件应用程序时,它不能这样做成功。您需要获取 Cordova 的更新。
回答by Yoh Suzuki
I got it working by adding references to the various architectures under the "Valid Architectures" field of the "Build Settings" for bothmy project and the referenced CordovaLib project. Screenshot attached. (I'm using Xcode to accomplish this instead of editing the pbxproj file in a text editor as suggested by someone in the Jira case).
我通过在我的项目和引用的 CordovaLib 项目的“构建设置”的“有效架构”字段下添加对各种架构的引用来使其工作。附上截图。(我使用 Xcode 来完成此操作,而不是按照 Jira 案例中某人的建议在文本编辑器中编辑 pbxproj 文件)。
The only caveat is that this method requires Cordova 2.0+, because that's the first version that references the Cordova project and source. You need to build Cordova with these settings. If you are using a previous version and don't want to upgrade, you'll have to obtain the source and build it yourself with this change to the architecture build settings.
唯一需要注意的是,此方法需要 Cordova 2.0+,因为这是引用 Cordova 项目和源的第一个版本。您需要使用这些设置构建 Cordova。如果您使用的是以前的版本并且不想升级,则必须获取源代码并通过对架构构建设置的此更改自行构建。
More information: https://issues.apache.org/jira/browse/CB-1360
更多信息:https: //issues.apache.org/jira/browse/CB-1360