Xcode10、Xcode 11 運(yùn)行老程序報(bào)錯dyld: Library not loaded: /usr/lib/libstdc++.6.dylib解決方案

控制臺輸出報(bào)錯內(nèi)容:

dyld: Library not loaded: /usr/lib/libstdc++.6.dylib
  Referenced from: /Users/yangming/Library/Developer/CoreSimulator/Devices/14C9AC08-7C07-4CED-A8EC-E93D0EA73953/data/Containers/Bundle/Application/73F84C0D-9D2D-474D-9947-F249B0CEEB15/CreatingCEP.app/CreatingCEP
  Reason: no suitable image found.  Did find:
    /usr/lib/libstdc++.6.dylib: mach-o, but not built for iOS simulator
(lldb) 

這個錯誤原因是因?yàn)閕OS12.0之后去掉了lstdc++.6.0.9.tbd動態(tài)庫,如下圖搜索便知:


image.png

iOS12.0中全部采用libc++代替lstdc++的動態(tài)庫(如下圖)


image.png

解決方案

Xcode10下:

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

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

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

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

Xcode11下:
第一條iOS.simruntime的路徑發(fā)生了變更,Xcode10中是../Developer/Library/..,而Xcode11中是.../Library/Developer/...

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

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

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

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/
為了方便大家,在此提供lstdc++動態(tài)庫文件下載和DeviceSupport下載 鏈接:

libstdc

文章參考自:http://www.itdecent.cn/p/3afd5e8cdbf8

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容