【发布时间】:2015-07-20 09:20:05
【问题描述】:
我将同事的 macbook 的 xcode 更新为 6.4,并从我们的 subversion repo 中查看了一个项目。清理并构建它,但出现错误消息,指出“ld:找不到文件...”,然后是“clang:错误:链接器命令失败,退出代码 1(使用 -v 查看调用)”。这些消息被归类为“Apple Mach-O Linker Error”。这些错误不会发生在我用于开发此项目的 macbook 上。
找到了一些其他人尝试过的解决方案,但对我不起作用。 这是我的设置:
- 基础 SDK:最新 iOS(iOS 8.4)
- 构建设置 > 架构 > 仅构建活动架构 > 调试 > 是。只有 Debug 是 Yes。
- 构建设置 > 架构 > 有效架构 > arm64 arm7 armv7s
- 部署信息 > 部署目标 > 8.2
- 我正在使用 Photos.framework 和 MobileCoreServices.framework
我怀疑我同事的 MacBook 上缺少某些库或文件,但不能确定。有没有办法找到这个?我也愿意尝试其他解决方案。
我发现问题出在我从 subversion 签出的项目上。在有我的项目的同一台计算机上,如果我要从 subversion 中签出,它将无法运行并且与我同事的笔记本电脑具有相同的错误消息。
这是我所做的:
- 导航到 DerivedData 文件夹并将其全部删除。清理并构建解决方案。
整个错误信息如下:
Ld /Users/XXX/Library/Developer/Xcode/DerivedData/MyProj-fnouqouxukjwszadgmsdxsqmdgbt/Build/Products/Debug-iphonesimulator/MyProjTests.xctest/MyProjTests normal x86_64
cd /Users/XXX/xxxmios/MyProj
export IPHONEOS_DEPLOYMENT_TARGET=8.2
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -bundle -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk -L/Users/XXX/Library/Developer/Xcode/DerivedData/MyProj-fnouqouxukjwszadgmsdxsqmdgbt/Build/Products/Debug-iphonesimulator -F/Users/XXX/Library/Developer/Xcode/DerivedData/MyProj-fnouqouxukjwszadgmsdxsqmdgbt/Build/Products/Debug-iphonesimulator -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk/Developer/Library/Frameworks -filelist /Users/NIE/Library/Developer/Xcode/DerivedData/MyProj-fnouqouxukjwszadgmsdxsqmdgbt/Build/Intermediates/MyProj.build/Debug-iphonesimulator/MyProjTests.build/Objects-normal/x86_64/MyProjTests.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -bundle_loader /Users/XXX/Library/Developer/Xcode/DerivedData/MyProj-fnouqouxukjwszadgmsdxsqmdgbt/Build/Products/Debug-iphonesimulator/MyProj.app/MyProj -Xlinker -objc_abi_version -Xlinker 2 -framework XCTest -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -Xlinker -add_ast_path -Xlinker /Users/XXX/Library/Developer/Xcode/DerivedData/MyProj-fnouqouxukjwszadgmsdxsqmdgbt/Build/Intermediates/MyProj.build/Debug-iphonesimulator/MyProjTests.build/Objects-normal/x86_64/MyProjTests.swiftmodule -mios-simulator-version-min=8.2 -Xlinker -dependency_info -Xlinker /Users/XXX/Library/Developer/Xcode/DerivedData/MyProj-fnouqouxukjwszadgmsdxsqmdgbt/Build/Intermediates/MyProj.build/Debug-iphonesimulator/MyProjTests.build/Objects-normal/x86_64/MyProjTests_dependency_info.dat -o /Users/XXX/Library/Developer/Xcode/DerivedData/MyProj-fnouqouxukjwszadgmsdxsqmdgbt/Build/Products/Debug-iphonesimulator/MyProjTests.xctest/MyProjTests
ld: file not found: /Users/XXX/Library/Developer/Xcode/DerivedData/MyProj-fnouqouxukjwszadgmsdxsqmdgbt/Build/Products/Debug-iphonesimulator/MyProj.app/MyProj
clang: error: linker command failed with exit code 1 (use -v to see invocation)
【问题讨论】: