问题
I'm getting error regarding duplicate symbols for architecture armv7. In my ~/Library/Developer/Xcode/DerivedData/Lyearn-grsqfwtcaisfvocmxxxiqgoezpco/Build/Products/Debug-iphoneos
the following files exists:
libEGOCache.a
libPods-EGOCache.a
libPods-UAProgressView.a
libSDWebImage.a
libFSImageViewer.a
libPods-FSImageViewer.a
libPods-WebASDKImageManager.a
libUAProgressView.a
libPods-AFNetworking.a
libPods-ICViewPager.a
libPods-pop.a
libWebASDKImageManager.a
libPods-AsyncDisplayKit.a
libPods-SDWebImage.a
libPods.a
libpop.a
Looking at this looks like not both libPods-XXX.a and libXXX.a should exist or should be included. My project is in swift. I have one of the file in objective c. To give this file access to swift classes I included APPNAME-Swift.h
. Also I have included all these in APPNAME-Bridging-Header.h
as it's required by Swift classes. This problem turned up after I removed one of the pod library from my PodFile and did pod install
How do I remove this?
I checked this question but it says that I'm importing .m file whereas I'm not doing that I'm always using .h files only
EDIT #1
I tried removing libPods.a from Binary Linked Libraries and the code compiled. I removed one more library and problem is back. Also after removing library from PodFile and doing pod install
libPods.a` got automatically included in the Linked Binary Libraries. I tried removing it again but am still getting the error.
After doing this I'm getting new error :
ld: warning: directory not found for option '-L/Users/USERNAME/APP-NAME/build/Debug-iphoneos'
ld: library not found for -lPods-AFNetworking
After seeing answer here and removing latter entry from Library Search paths to just ($inherited) removed the first error and now just getting lPods-AFNetworking error.
This is the error log:
Ld /Users/USERNAME/Library/Developer/Xcode/DerivedData/APP-NAME-grsqfwtcaisfvocmxxxiqgoezpco/Build/Products/Debug-iphoneos/APP-NAME.app/APP-NAME normal armv7
cd /Users/USERNAME/APP-NAME-ios
export IPHONEOS_DEPLOYMENT_TARGET=7.1
export 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 armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk -L/Users/USERNAME/Library/Developer/Xcode/DerivedData/APP-NAME-grsqfwtcaisfvocmxxxiqgoezpco/Build/Products/Debug-iphoneos -F/Users/USERNAME/Library/Developer/Xcode/DerivedData/APP-NAME-grsqfwtcaisfvocmxxxiqgoezpco/Build/Products/Debug-iphoneos -F/Users/USERNAME/APP-NAME-ios -F/Users/USERNAME/APP-NAME-ios/Frameworks -filelist /Users/USERNAME/Library/Developer/Xcode/DerivedData/APP-NAME-grsqfwtcaisfvocmxxxiqgoezpco/Build/Intermediates/APP-NAME.build/Debug-iphoneos/APP-NAME.build/Objects-normal/armv7/APP-NAME.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -dead_strip -ObjC -lAFNetworking -lAsyncDisplayKit -lEGOCache -lFSImageViewer -lICViewPager -lSDWebImage -lUAProgressView -lWebASDKImageManager -lc++ -lpop -framework AssetsLibrary -framework CFNetwork -framework CoreGraphics -framework Foundation -framework ImageIO -framework MobileCoreServices -framework QuartzCore -framework Security -framework SystemConfiguration -framework UIKit -weak_framework Photos -ObjC -lPods-AFNetworking -framework CoreGraphics -framework MobileCoreServices -framework Security -framework SystemConfiguration -all_load -fobjc-arc -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -Xlinker -force_load -Xlinker /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphoneos.a -Xlinker -add_ast_path -Xlinker /Users/USERNAME/Library/Developer/Xcode/DerivedData/APP-NAME-grsqfwtcaisfvocmxxxiqgoezpco/Build/Intermediates/APP-NAME.build/Debug-iphoneos/APP-NAME.build/Objects-normal/armv7/APP-NAME.swiftmodule -miphoneos-version-min=7.1 -framework Security -framework Foundation -framework UIKit -framework Social -framework Accounts -lsqlite3 -framework Crashlytics -lz -framework SystemConfiguration -framework DBChooser -framework StoreKit -framework QuartzCore -framework MobileCoreServices -framework CoreLocation -framework Fabric -framework Bolts -framework CoreGraphics -framework GooglePlus -framework CFNetwork -framework AudioToolbox -lPods -Xlinker -dependency_info -Xlinker /Users/USERNAME/Library/Developer/Xcode/DerivedData/APP-NAME-grsqfwtcaisfvocmxxxiqgoezpco/Build/Intermediates/APP-NAME.build/Debug-iphoneos/APP-NAME.build/Objects-normal/armv7/APP-NAME_dependency_info.dat -o /Users/USERNAME/Library/Developer/Xcode/DerivedData/APP-NAME-grsqfwtcaisfvocmxxxiqgoezpco/Build/Products/Debug-iphoneos/APP-NAME.app/APP-NAME
ld: library not found for -lPods-AFNetworking
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It looks like it's trying to include -lAFNetworking and -lPods-AFNetworking.
回答1:
The problem got solved. I had a problem mostly because of updating cocoapods. Somehow updating cocoapods created two versions of cocoapods. Uninstalling it completely and reinstalling cocoapods fixed the issue after pod install.
来源:https://stackoverflow.com/questions/31921701/ios-duplicate-symbols-for-architecture-armv7