升級Xcode 10 后報錯問題記錄([CP] Copy Pods Resources)&& library not found for -libstdc++.6.0.9


1、升級Xcode到Version 10.0 (10A255)后,運行已有項目,報如下錯誤:

error: Multiple commands produce '/Users/galahad/Library/Developer/Xcode/DerivedData/yoowei-drnrntneloepunakcqbcdycudqeh/Build/Products/Debug-iphoneos/yoowei.app':

1) Target 'yoowei' has create directory command with output '/Users/galahad/Library/Developer/Xcode/DerivedData/yoowei-drnrntneloepunakcqbcdycudqeh/Build/Products/Debug-iphoneos/yoowei.app'

2) That command depends on command in Target 'yoowei': script phase “[CP] Copy Pods Resources”

 

原因:Xcode 10 默認使用的build system是New build system,與Xcode9不同導致。

解決:2種方法

1)第一種方法 不修改build system 

根據error 日志,script phase “[CP] Copy Pods Resources”,而且與output有關,應該是使用了cocoapods導致的,嘗試刪除該項目target-Copy Pods Resources-Output Files,成功解決問題。選中項目target -> Build phase -> Copy Pods Resources -> Output Files -> 移除${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}  然后重新編譯,OK 。

用這種方式緊接着會有下面的錯誤:

error: Cycle in dependencies between targets 'yooweiExtension' and 'yoowei'; building could produce unreliable results.

Cycle path: yooweiExtension → yoowei → yooweiExtension

Cycle details:

→ Target 'yooweiExtension': CodeSign /Users/galahad/Library/Developer/Xcode/DerivedData/yoowei-drnrntneloepunakcqbcdycudqeh/Build/Products/Debug-iphoneos/yooweiExtension.appex

○ Target 'yooweiExtension': ProcessProductPackaging  /Users/galahad/Library/Developer/Xcode/DerivedData/yoowei-drnrntneloepunakcqbcdycudqeh/Build/Intermediates.noindex/yoowei.build/Debug-iphoneos/yooweiExtension.build/yooweiExtension.appex.xcent

○ Target 'yooweiExtension' has target dependency on Target 'yoowei'

→ Target 'yoowei' has target dependency on Target 'yooweiExtension'

○ That command depends on command in Target 'yooweiExtension': script phase “[CP] Check Pods Manifest.lock”

對應的解決方案:選中項目target -> Build phase -> Target Dependencies  去掉相互的依賴即可

 

2)第二種方法 修改build system 
在Xcode菜單欄 -> File -> Workspace Setting,將build system修改為legacy build system,然后clean后編譯。

2、典型問題

ld: library not found for -lstdc++.6.0.9

clang: error: linker command failed with exit code 1 (use -v to see invocation)

解決方案:(我一般升級xcode 之前都會將lib 給備份一份。具體路徑是:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib )

1、提前在xcode 9中 根據路徑   /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib 找到 libstdc++.6.0.9.tbd  備份

2、復制剛才的libstdc++.6.0.9.tbd 文件,手動添加到 升級后的xcode 10  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib 文件夾中,運行即可。

需要的話,可以找我要。注意分真機和模擬器環境:

1.真機環境:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/
2.模擬器環境:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/ 

20190313遇到一種情況:編譯報錯     library not found for -l"stdc++.6.0.9" 

比較奇怪就是,我已經按照上面將libstdc++.6.0.9.tbd 手動添加過了。但是為什么還會報錯呢?

解決辦法:

打開Build Phases--Link Binary With Libraries,刪除6.0.9依賴   添加Libc++.tdb 即可。

如果依賴c++6.0.9的SDK是第三方SDK等待第三方更新解決。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM