2015-07-20 98 views
0

我将我的同事的macbook的xcode更新为6.4,并从我们的颠覆回购中检出项目。清理并构建它,但出现错误消息,指出“ld:file not found ...”后面跟着“clang:error:linker命令失败,退出代码1(使用-v查看调用)”。这些消息被归类为“Apple Mach-O链接器错误”。这些错误不会发生在我用来开发此项目的Macbook上。链接器命令失败,退出代码1 xcode 6.4

找到了其他人尝试过的一些解决方案,但它对我无效。 这里是我的设置:

  1. 基地SDK:最新的iOS(iOS版8.4)
  2. 生成设置>架构>构建有源体系仅>调试>是。只有调试是。
  3. 生成设置>架构>有效架构> arm64 ARM7 armv7s
  4. 部署信息>部署目标> 8.2
  5. 我使用的Photos.framework和MobileCoreServices.framework

我怀疑一些图书馆或者我的同事的MacBook上缺少文件,但无法确定。有没有办法找到这个?我也很乐意尝试其他解决方案。

我发现问题在于我从颠覆中检出的项目。在具有我的项目的同一台计算机上,如果我要从颠覆中结帐,它将不会运行,并且与我的同事的笔记本电脑有相同的错误消息。

这里是我做了什么:

  1. 导航到DerivedData文件夹,并删除了这一切。清理并构建解决方案。

如下整体错误消息:按CMD + Shift + K

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) 

回答

1

从另一个问题here找到解决方案。

我用@ Chepe77答案来解决我的问题。我将在这里复制并粘贴@Chepe77答案。

  1. 在项目导航器中选择您的项目。
  2. 选择下的目标
  3. 在常规选项卡上的YourProjectTests改变从下拉
  4. 编译和运行主机应用。
+0

我有这个相同的错误,但不工作...自从yeseterday – 2015-09-17 05:25:50

1

清洁您的Xcode项目。然后重建你的项目。

+1

做了几次。事实上,我每次都会尝试一种可能的解决方案。 – winhung

0

你构建设置应该是

Architectures > Valid Architectures > arm64 armv7 armv7s

和体系结构部分中选择标准架构。

并检查您是否错过了有用的框架。

+0

是的,他们是这些体系结构,是必要的框架。再次移除并添加它们并不能解决问题。但是,谢谢你的回复。 – winhung

0

你的建筑应该改变arm7 - > armv7。

相关问题