【问题标题】:linker command failed with exit code 1 xcode 6.4 [duplicate]链接器命令失败,退出代码为 1 xcode 6.4 [重复]
【发布时间】:2015-07-20 09:20:05
【问题描述】:

我将同事的 macbook 的 xcode 更新为 6.4,并从我们的 subversion repo 中查看了一个项目。清理并构建它,但出现错误消息,指出“ld:找不到文件...”,然后是“clang:错误:链接器命令失败,退出代码 1(使用 -v 查看调用)”。这些消息被归类为“Apple Mach-O Linker Error”。这些错误不会发生在我用于开发此项目的 macbook 上。

找到了一些其他人尝试过的解决方案,但对我不起作用。 这是我的设置:

  1. 基础 SDK:最新 iOS(iOS 8.4)
  2. 构建设置 > 架构 > 仅构建活动架构 > 调试 > 是。只有 Debug 是 Yes。
  3. 构建设置 > 架构 > 有效架构 > arm64 arm7 armv7s
  4. 部署信息 > 部署目标 > 8.2
  5. 我正在使用 Photos.framework 和 MobileCoreServices.framework

我怀疑我同事的 MacBook 上缺少某些库或文件,但不能确定。有没有办法找到这个?我也愿意尝试其他解决方案。

我发现问题出在我从 subversion 签出的项目上。在有我的项目的同一台计算机上,如果我要从 subversion 中签出,它将无法运行并且与我同事的笔记本电脑具有相同的错误消息。

这是我所做的:

  1. 导航到 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)

【问题讨论】:

    标签: ios swift xcode6


    【解决方案1】:

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

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

    1. 在项目导航器中选择您的项目。
    2. 选择目标下的 YourProjectTests
    3. 在常规选项卡下,从下拉列表中更改主机应用程序
    4. 构建并运行。

    【讨论】:

    • 我有同样的错误,但不起作用...从昨天开始就在敲头
    • 没有工作....
    • 嗯,不工作:/
    【解决方案2】:

    按 cmd+shift+k 清理您的 xcode 项目。然后重建您的项目。

    【讨论】:

    • 做了几次。事实上,我每次尝试可能的解决方案时都会这样做。
    【解决方案3】:

    你的构建设置应该是

    架构 > 有效架构 > arm64 armv7 armv7s

    并在架构部分选择标准架构。

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

    【讨论】:

    • 是的,它们属于这些架构,是的,必要的框架在里面。删除并再次添加它们并没有解决问题。不过还是谢谢你的回复。
    【解决方案4】:

    您的架构应该更改为 arm7 -> armv7。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-28
      相关资源
      最近更新 更多