集成友盟分享和支付宝静态库冲突

2019-10-12  本文已影响0人  笃行丶

ld: warning: directory not found for option '-L/Users/zh_pro/Desktop/砺行公考/上岸/Helper/EaseUI/EMUIKit/3rdparty/DeviceHelper/VoiceConvert/opencore-amrwb'
ld: warning: directory not found for option '-L/Users/zh_pro/Desktop/砺行公考/上岸/Helper/EaseUI/EMUIKit/3rdparty/DeviceHelper/VoiceConvert/opencore-amrnb'
ld: warning: directory not found for option '-L/Users/zh_pro/Desktop/砺行公考/上岸/Helper/HuanxinKF/HelpDeskUI/HDUIKit/3rdparty/DeviceHelper/HDVoiceConvert/opencore-amrwb'
ld: warning: directory not found for option '-L/Users/zh_pro/Desktop/砺行公考/上岸/Helper/HuanxinKF/HelpDeskUI/HDUIKit/3rdparty/DeviceHelper/HDVoiceConvert/opencore-amrnb'
ld: warning: directory not found for option '-F/Users/zh_pro/Desktop/砺行公考/Pods/Hyphenate/iOS_Pods_IMFullSDK_V3.5.2'
ld: warning: directory not found for option '-F/Users/zh_pro/Desktop/砺行公考/上岸/Helper/HuanxinKF'
duplicate symbol OBJC_CLASS_UTDIDAES in: /Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK /Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDIDAES.o) duplicate symbol _OBJC_METACLASS__UTDIDAES in:
/Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK
/Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDIDAES.o)
duplicate symbol OBJC_CLASS_UTDIDBaseUtils in: /Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK /Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDIDBaseUtils.o) duplicate symbol _OBJC_METACLASS__UTDIDBaseUtils in:
/Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK
/Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDIDBaseUtils.o)
duplicate symbol OBJC_CLASS_AidRequester in: /Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK /Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(AidRequester.o) duplicate symbol _OBJC_METACLASS__AidRequester in:
/Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK
/Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(AidRequester.o)
duplicate symbol OBJC_CLASS_AidManager in: /Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK /Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(AidManager.o) duplicate symbol _OBJC_METACLASS__AidManager in:
/Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK
/Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(AidManager.o)
duplicate symbol OBJC_CLASS_UTDIDIntUtils in: /Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK /Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDIDIntUtils.o) duplicate symbol _OBJC_METACLASS__UTDIDIntUtils in:
/Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK
/Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDIDIntUtils.o)
duplicate symbol OBJC_CLASS_UTDIDStringUtils in: /Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK /Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDIDStringUtils.o) duplicate symbol _OBJC_METACLASS__UTDIDStringUtils in:
/Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK
/Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDIDStringUtils.o)
duplicate symbol OBJC_CLASS_UTDIDTypeConvert in: /Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK /Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDIDTypeConvert.o) duplicate symbol _OBJC_METACLASS__UTDIDTypeConvert in:
/Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK
/Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDIDTypeConvert.o)
duplicate symbol OBJC_CLASS_UTDIDMain in: /Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK /Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDIDMain.o) duplicate symbol _OBJC_METACLASS__UTDIDMain in:
/Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK
/Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDIDMain.o)
duplicate symbol OBJC_CLASS_UTDIDOpenUDID in: /Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK /Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDIDOpenUDID.o) duplicate symbol _OBJC_METACLASS__UTDIDOpenUDID in:
/Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK
/Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDIDOpenUDID.o)
duplicate symbol OBJC_CLASS_UTDIDHelper in: /Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK /Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDIDHelper.o) duplicate symbol _OBJC_METACLASS__UTDIDHelper in:
/Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK
/Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDIDHelper.o)
duplicate symbol OBJC_CLASS_AidStorage in: /Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK /Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(AidStorage.o) duplicate symbol _OBJC_METACLASS__AidStorage in:
/Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK
/Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(AidStorage.o)
duplicate symbol OBJC_CLASS_UTDevice in: /Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK /Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDevice.o) duplicate symbol _OBJC_METACLASS__UTDevice in:
/Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK
/Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDevice.o)
duplicate symbol OBJC_IVAR_UTDIDKeychainItemWrapper.genericPasswordQuery in: /Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK /Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDIDKeychainItemWrapper.o) duplicate symbol _OBJC_CLASS__UTDIDKeychainItemWrapper in:
/Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK
/Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDIDKeychainItemWrapper.o)
duplicate symbol OBJC_METACLASS_UTDIDKeychainItemWrapper in: /Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK /Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDIDKeychainItemWrapper.o) duplicate symbol _OBJC_IVAR__UTDIDKeychainItemWrapper.keychainItemData in:
/Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK
/Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDIDKeychainItemWrapper.o)
duplicate symbol OBJC_CLASS_UTDIDPersistentConf in: /Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK /Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDIDPersistentConf.o) duplicate symbol _OBJC_METACLASS__UTDIDPersistentConf in:
/Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK
/Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDIDPersistentConf.o)
duplicate symbol OBJC_CLASS_UTDIDPersistentFile in: /Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK /Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDIDPersistentFile.o) duplicate symbol _OBJC_METACLASS__UTDIDPersistentFile in:
/Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK
/Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDIDPersistentFile.o)
duplicate symbol OBJC_CLASS_UTDIDGTMBase64 in: /Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK /Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDIDGTMBase64.o) duplicate symbol _OBJC_METACLASS__UTDIDGTMBase64 in:
/Users/zh_pro/Desktop/砺行公考/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK
/Users/zh_pro/Desktop/砺行公考/Pods/UMCSecurityPlugins/thirdparties/UTDID.framework/UTDID(UTDIDGTMBase64.o)
ld: 34 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

以上是错误信息
解决办法:
只需要删除其中一个冲突库就行了

1· 简单办法 直接替换 (网盘连接 一个没有UTDID.framework 的支付宝SDK
来源:https://www.jianshu.com/p/7689b334bbd3
感谢作者

2· 利用Mac的 lipo 命令 操作SDK文件 (该方式来源:https://www.jianshu.com/p/9c9d5f6af6ff
感谢作者

解决方式
mac OS 下使用命令行工具 lipo来的对静态库进行处理。
一、设置 other linker flags
Bulding Setting里设置的other linker flags添加的有-Objc,而-Objc得作用就是将加载的静态库中的分类一并加载到程序的可执行文件,如果不添加这个参数,很有可能会出现selector not recognized问题,主要是找不到分类定义的方法。
-Objc添加后就会出现多个静态库定义同样的方法、全局变量等,然后就会出现上面的问题duplicate symbol。
other linker flags解析

-ObjC:加了这个参数后,链接器就会把静态库中所有的Objective-C类和分类都加载到最后的可执行文件中
-all_load:会让链接器把所有找到的目标文件都加载到可执行文件中,但是千万不要随便使用这个参数!假如你使用了不止一个静态库文件,然后又使用了这个参数,那么你很有可能会遇到ld: duplicate symbol错误,因为不同的库文件里面可能会有相同的目标文件,所以建议在遇到-ObjC失效的情况下使用-force_load参数。
-force_load:所做的事情跟-all_load其实是一样的,但是-force_load需要指定要进行全部加载的库文件的路径,这样的话,你就只是完全加载了一个库文件,不影响其余库文件的按需加载
这种方式,如果项目中第三方库很多,比较难管理
二、修改静态库
1、找到静态库文件 libWintonePlateIDPro.a 源文件,新建一个文件夹专门处理

2、查看包信息 lipo -info libWintonePlateIDPro.a

3、创建临时文件夹,用于存放armv7平台解压后的.o文件:mkdir armv7

4、查看库中所包含的文件列表:ar -t armv7/libWintonePlateIDPro.a

5、解压出.o后缀文件:cd armv7 && ar xv libWintonePlateIDPro-armv7.a

6、找到冲突的包(RXMLElement.o),删除掉 rm RXMLElement.o

7、重新打包成 .a:cd .. && ar rcs libWintonePlateIDPro-armv7.a armv7/*.o,可以使用[4]命令查看是否成功

8、将其他几个平台(armv7s, arm64,i386)包逐一做上述[1-7]操作

9、重新合并为libWintonePlateIDPro的.a文件:lipo -create libWintonePlateIDPro-armv7.a libWintonePlateIDPro-armv7s.a -output libWintonePlateIDPro-new.a

上一篇下一篇

猜你喜欢

热点阅读