一、升级Xcode到Version 10.0 (10A255)后,运行已有项目,报以下错误:c++
error: Multiple commands produce '/Users/galahad/Library/Developer/Xcode/DerivedData/yoowei-drnrntneloepunakcqbcdycudqeh/Build/Products/Debug-iphoneos/yoowei.app':xcode
1) Target 'yoowei' has create directory command with output '/Users/galahad/Library/Developer/Xcode/DerivedData/yoowei-drnrntneloepunakcqbcdycudqeh/Build/Products/Debug-iphoneos/yoowei.app'bash
2) That command depends on command in Target 'yoowei': script phase “[CP] Copy Pods Resources”app
缘由:Xcode 10 默认使用的build system是New build system,与Xcode9不一样致使。iphone
解决:2种方法ui
1)第一种方法 不修改build system spa
根据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 。
日志
Cycle path: yooweiExtension → yoowei → yooweiExtensioncode
Cycle details:orm
→ 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后编译。
二、典型问题
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 )
一、提早在xcode 9中 根据路径 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib 找到 libstdc++.6.0.9.tbd 备份
二、复制刚才的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等待第三方更新解决。