解决Xcode10 Library not loaded: /usr/lib/libstdc++.6造成的crash及报错

由于Xcode10 废弃了libstdc++,库文件libstdc++.6.0.9. dylib、libstdc++.6. dylib、libstdc++. dylib、libstdc++.6.0.9.tbd、libstdc++.6.tbd、libstdc++.tbd也删除,所以在编译时某些模块会error或crash。
如:
dyld: Library not loaded: /usr/lib/libstdc++.6.dylib
Referenced from: /Users/xxh/Library/Developer/CoreSimulator/Devices/063C2EF2-5F01-4EC6-A34A-5E10EDF24C9E/data/Containers/Bundle/Application/B23D9872-61B0-4A7C-9FAA-0116FAC1563A/DYEngineer.app/DYEngineer
Reason: no suitable image found. Did find:
/usr/lib/libstdc++.6.dylib: mach-o, but not built for iOS simulator 等。

解决方案是从Xcode9的包中替换相应的文件。


 
库文件.png
-libstdc++.6.0.9.tbd
-libstdc++.6.tbd
-libstdc++.tbd
-libstdc++.6.0.9.dylib
-libstdc++.6.dylib
-libstdc++.dylib

写在前方 笔者建议:最好把缓存清除下再操作

一、Xcode10支持手机
方案:需要增加一个地址3个文件

地址1:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/libstdc++.6.0.9.tbd

二、Xcode10支持模拟器
方案:需要增加两个个地址3+3==6个文件

地址2:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libstdc++.6.0.9.dylib

地址3:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/libstdc++.6.0.9.tbd

三、macOS开发需要再增加一个地址3个文件
地址4:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libstdc++.6.0.9.tbd

四、在Xcode7曾出现大规模病毒感染,而后苹果在Xcode8也封禁了插件,建议libstdc++文件从Xcode9中
--显示包内容获取。

附加文件:Xcode10-libstdc-6.0.9.tbd-master.zip 

posted on 2019-01-24 17:06  程序“猿”  阅读(2278)  评论(0编辑  收藏  举报

导航