更新Xcode11Beta后,因缺少libstdc++.6.dylib模拟器报错问题解决

4,826 阅读1分钟

更新Xcode11后因为缺少libstdc++.6.dylib文件报错,按照Xcode10的方法设置后运行模拟器发现还是报错,错误如下:

Reason: no suitable image found. Did find:
/usr/lib/libstdc++.6.dylib: mach-o, but not built for iOS simulator

根据原来Xcode10的设置方法,需要将就Xcode的如下路径的libstdc++.6.0.9.dylib、libstdc++.6.dylib、libstdc++.dylib三个文件拷贝到新的Xcode对应路径中,路径如下:

/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

但是发现Xcode11的/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library路径中并没有CoreSimulator文件夹,所以无法设置。

查找资料后发现Xcode11的CoreSimulator文件夹被移至到/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/这个路径下,所以将旧的Xcode中的libstdc++.6.0.9.dylib、libstdc++.6.dylib、libstdc++.dylib三个文件移至新目录下就可以解决上述问题。路径如下:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/