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 等。

解决方法

模拟器库添加地址

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib

添加三个文件 到xcode 9 版本中找到这3个文件
71A09C627C6165F14753EB4D4B1A44D1.png

真机库添加地址

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib

再运行xcode发现 又出问题了

Did find:
/usr/lib/libstdc++.6.dylib: mach-o, but not built for iOS simulato
解决办法
1、找到Xcode9 旧版的/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

把找到的libstdc++.6.0.9.dylib赋值到新版Xcode同样的目录下,右键复制copy到同目录下取名叫libstdc++.6.dylib和libstdc++.dylib 即可

以下是整理的需要的文件,给没有旧版本的同学
链接: https://pan.baidu.com/s/1Hl8ZVX7qGpwwittgwPPgiA 提取码: 4f2f

你可能感兴趣的:(Xcode10 Library not loaded: /usr/lib/libstdc++.6造成的crash及报错)