Clang Error in XCode

2020-02-13 12:45发布

问题:

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:

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)

回答1:

Change "Build Active Architecure Only" to Yes, and it will work :) cheers!



回答2:

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.



回答3:

I got it working by adding references to the various architectures under the "Valid Architectures" field of the "Build Settings" for both my 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).

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.

More information: https://issues.apache.org/jira/browse/CB-1360



回答4:

Nothing solved for me yet, but some developer had success with this url