0

I updated my colleague's macbook's xcode to 6.4 and check out a project from our subversion repo. Clean and build it but a error msg appears stating that, "ld: file not found..." followed by "clang: error: linker command failed with exit code 1 (use -v to see invocation)". These messages were categorised as "Apple Mach-O Linker Error". These errors do not occur on the macbook that i am using to develop this project.

Found a few solutions that others have tried but it did not work for me. Here are my settings:

  1. Base SDK: Latest iOS(iOS 8.4)
  2. Build Settings > Architectures > Build Active Architecture Only > Debug > Yes. Only Debug is Yes.
  3. Build Settings > Architectures > Valid Architectures > arm64 arm7 armv7s
  4. Deployment Info > Deployment Target > 8.2
  5. I am using the Photos.framework and MobileCoreServices.framework

I am suspecting that some libraries or files are missing on my colleague's MacBook but can't be sure. Is there a way to find this? I am open to trying out other solutions as well.

I found out that the problem lies with the project that i checked out from the subversion. On the same computer that has my project, if i were to checkout from subversion, it will not run and has the same error message as my colleague's laptop.

Here's what i have done:

  1. Navigated to the DerivedData folder and deleted it all away. Clean and Build solution.

Whole error message as follows:

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)
winhung
  • 553
  • 1
  • 5
  • 19

4 Answers4

2

Found the solution from another question here.

I used @Chepe77 answer to resolve my problem. I will just copy and paste @Chepe77 answer here.

  1. Select your project in the project navigator.
  2. Select the YourProjectTests under targets
  3. Under General tab change the Host Application from the drop down
  4. Build and run.
Community
  • 1
  • 1
winhung
  • 553
  • 1
  • 5
  • 19
1

Clean your xcode project by pressing cmd+shift+k. Then rebuild your project.

Codobux
  • 1,028
  • 1
  • 12
  • 15
0

Your Build Settings should be

Architectures > Valid Architectures > arm64 armv7 armv7s

and select Standards Architectures in Architectures section.

And check whether you have missed useful frameworks or not.

Waruna
  • 162
  • 8
  • Yes they are of these architectures and yes the necessary frameworks are inside. Removing and adding them again did not solve the problem. But still, thank you for your reply. – winhung Jul 21 '15 at 04:00
0

Your Architecture should be change arm7 -> armv7.

Waruna
  • 162
  • 8