clang failed with exit code 1 when building Archiv

2019-07-29 01:35发布

问题:

My build settings show my Developer provisioning profile for Debug and my Distribution provisioning profile for the Release and Distribution schemes. I've verified that my Distribution provisioning profile is up to date and doesn't expire until August of 2012, so that's not the problem.

Ld /Users/kenny/Library/Developer/Xcode/DerivedData/MyAppName-fxknidnbrepotqdvhgjnepxdhonz/ArchiveIntermediates/BalanceSheet/IntermediateBuildFilesPath/MyAppName.build/Release-iphoneos/MyAppName.build/Objects-normal/armv6/MyAppName normal armv6
    cd /Users/kenny/MyLib2/svn-MyAppName-iOS/trunk/MyAppName
    setenv IPHONEOS_DEPLOYMENT_TARGET 3.2
    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 armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -L/Users/kenny/Library/Developer/Xcode/DerivedData/MyAppName-fxknidnbrepotqdvhgjnepxdhonz/ArchiveIntermediates/BalanceSheet/BuildProductsPath/Release-iphoneos -L/Users/kenny/MyLib2/svn-MyAppName-iOS/trunk/MyAppName -L/Users/kenny/MyLib2/svn-MyAppName-iOS/trunk/MyAppName/../../../svn-Flurry/trunk/FlurryLib -F/Users/kenny/Library/Developer/Xcode/DerivedData/MyAppName-fxknidnbrepotqdvhgjnepxdhonz/ArchiveIntermediates/BalanceSheet/BuildProductsPath/Release-iphoneos -filelist /Users/kenny/Library/Developer/Xcode/DerivedData/MyAppName-fxknidnbrepotqdvhgjnepxdhonz/ArchiveIntermediates/BalanceSheet/IntermediateBuildFilesPath/MyAppName.build/Release-iphoneos/MyAppName.build/Objects-normal/armv6/MyAppName.LinkFileList -dead_strip -ObjC -all_load -miphoneos-version-min=3.2 -weak_framework Twitter /Users/kenny/Library/Developer/Xcode/DerivedData/MyAppName-fxknidnbrepotqdvhgjnepxdhonz/ArchiveIntermediates/BalanceSheet/BuildProductsPath/Release-iphoneos/libfacebook_ios_sdk.a -lMyLib_Networking -lMyLib_AdWhirl -lMyLib_ApplicationCore -lMyLib_Audio -framework Foundation -framework UIKit -framework CoreGraphics -framework CoreData -framework AudioToolbox -framework SystemConfiguration -weak_framework iAd -framework QuartzCore -framework CoreLocation -framework AVFoundation -framework MapKit -lsqlite3 -lz -framework MediaPlayer -framework MessageUI -lFlurry -o /Users/kenny/Library/Developer/Xcode/DerivedData/MyAppName-fxknidnbrepotqdvhgjnepxdhonz/ArchiveIntermediates/BalanceSheet/IntermediateBuildFilesPath/MyAppName.build/Release-iphoneos/MyAppName.build/Objects-normal/armv6/MyAppName

Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang failed with exit code 1

It doesn't provide an error message, it just gives the exit code message.

I've searched through the Apple forums and Stack Overflow, but either the other posts have some real linker error like duplicate symbols or they don't have an error like I do, but they don't have an answer.

I'm using Xcode 4.2.

Help?

回答1:

It looks like the problem had to do with the Architecture settings on my sub projects. Xcode 4.2 changes the default Architecture to just armv7 instead of both armv6 and armv7. I had updated my main project to armv6 and armv7, but the sub-projects were still only using armv7. Once I updated all of the sub-projects then it started linking properly.



回答2:

That error note doesn't really tell anything, it's too generic. Try to find something more, for example in Mac OS X console output.

Here's some of my experiences with "exit code 1": create new configuration and check that cerfitifate trust details are system default.



回答3:

If you are using xcodebuild to compile project to start debugging you may run command:

/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang -arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -L/Users/kenny/Library/Developer/Xcode/DerivedData/MyAppName-fxknidnbrepotqdvhgjnepxdhonz/ArchiveIntermediates/BalanceSheet/BuildProductsPath/Release-iphoneos -L/Users/kenny/MyLib2/svn-MyAppName-iOS/trunk/MyAppName -L/Users/kenny/MyLib2/svn-MyAppName-iOS/trunk/MyAppName/../../../svn-Flurry/trunk/FlurryLib -F/Users/kenny/Library/Developer/Xcode/DerivedData/MyAppName-fxknidnbrepotqdvhgjnepxdhonz/ArchiveIntermediates/BalanceSheet/BuildProductsPath/Release-iphoneos -filelist /Users/kenny/Library/Developer/Xcode/DerivedData/MyAppName-fxknidnbrepotqdvhgjnepxdhonz/ArchiveIntermediates/BalanceSheet/IntermediateBuildFilesPath/MyAppName.build/Release-iphoneos/MyAppName.build/Objects-normal/armv6/MyAppName.LinkFileList -dead_strip -ObjC -all_load -miphoneos-version-min=3.2 -weak_framework Twitter /Users/kenny/Library/Developer/Xcode/DerivedData/MyAppName-fxknidnbrepotqdvhgjnepxdhonz/ArchiveIntermediates/BalanceSheet/BuildProductsPath/Release-iphoneos/libfacebook_ios_sdk.a -lMyLib_Networking -lMyLib_AdWhirl -lMyLib_ApplicationCore -lMyLib_Audio -framework Foundation -framework UIKit -framework CoreGraphics -framework CoreData -framework AudioToolbox -framework SystemConfiguration -weak_framework iAd -framework QuartzCore -framework CoreLocation -framework AVFoundation -framework MapKit -lsqlite3 -lz -framework MediaPlayer -framework MessageUI -lFlurry -o /Users/kenny/Library/Developer/Xcode/DerivedData/MyAppName-fxknidnbrepotqdvhgjnepxdhonz/ArchiveIntermediates/BalanceSheet/IntermediateBuildFilesPath/MyAppName.build/Release-iphoneos/MyAppName.build/Objects-normal/armv6/MyAppName

separately and add -v flag, so that clang will print out which commands it executes internally. In this case it probably runs /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ld

You can also run again Debug sequence with xcodebuild and see what it does differently compared to Archive.

Hope that this gives some pointers how to debug build process.