ld: file not found: linker command failed with exit code 1
IosObjective CXcodeLinkerIos Problem Overview
I've got the following error when building the project in Xcode:
> ld: file not found
> /Users/MacBookPro/Library/Developer/Xcode/DerivedData/Social_Events-cfnteabiivwfdzcoulzznhmgobhy/Build/Products/Debug-iphoneos/Social_Events.app/Social_Events clang: error: linker command failed with exit code 1 (use -v to see invocation)
I'm stuck with this error for the past hour.. Any solutions? Code worked fine in iOS 7 and xCode 5.0. Now for iOS8 it gives me this error.
Using frameworks:
- CoreTelephony
- Mapkit
- Facebook.SDK v3.20
- Foundation
- CoreGraphics
- UIKit Framework
FULL ERROR:
<pre>
Ld /Users/MacBookPro/Library/Developer/Xcode/DerivedData/Social_Events-cfnteabiivwfdzcoulzznhmgobhy/Build/Intermediates/Social_Events.build/Debug-iphoneos/Social_EventsTests.build/Objects-normal/arm64/Social_EventsTests normal arm64
cd /Users/MacBookPro/Desktop/Social_Events/Social_Events/Social_Events
export IPHONEOS_DEPLOYMENT_TARGET=7.1
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
</pre>
>/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -bundle -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -L/Users/MacBookPro/Library/Developer/Xcode/DerivedData/Social_Events-cfnteabiivwfdzcoulzznhmgobhy/Build/Products/Debug-iphoneos -F/Users/MacBookPro/Library/Developer/Xcode/DerivedData/Social_Events-cfnteabiivwfdzcoulzznhmgobhy/Build/Products/Debug-iphoneos -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/Developer/Library/Frameworks -filelist /Users/MacBookPro/Library/Developer/Xcode/DerivedData/Social_Events-cfnteabiivwfdzcoulzznhmgobhy/Build/Intermediates/Social_Events.build/Debug-iphoneos/Social_EventsTests.build/Objects-normal/arm64/Social_EventsTests.LinkFileList -dead_strip -bundle_loader /Users/MacBookPro/Library/Developer/Xcode/DerivedData/Social_Events-cfnteabiivwfdzcoulzznhmgobhy/Build/Products/Debug-iphoneos/Social_Events.app/Social_Events -framework XCTest -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=7.1 -framework XCTest -framework UIKit -framework Foundation -Xlinker -dependency_info -Xlinker /Users/MacBookPro/Library/Developer/Xcode/DerivedData/Social_Events-cfnteabiivwfdzcoulzznhmgobhy/Build/Intermediates/Social_Events.build/Debug-iphoneos/Social_EventsTests.build/Objects-normal/arm64/Social_EventsTests_dependency_info.dat -o /Users/MacBookPro/Library/Developer/Xcode/DerivedData/Social_Events-cfnteabiivwfdzcoulzznhmgobhy/Build/Intermediates/Social_Events.build/Debug-iphoneos/Social_EventsTests.build/Objects-normal/arm64/Social_EventsTests
>ld: file not found: /Users/MacBookPro/Library/Developer/Xcode/DerivedData/Social_Events-cfnteabiivwfdzcoulzznhmgobhy/Build/Products/Debug-iphoneos/Social_Events.app/Social_Events
clang: error: linker command failed with exit code 1 (use -v to see invocation)
>(null): File not found: /Users/MacBookPro/Library/Developer/Xcode/DerivedData/Social_Events-cfnteabiivwfdzcoulzznhmgobhy/Build/Products/Debug-iphoneos/Social_Events.app/Social_Events
Ios Solutions
Solution 1 - Ios
You might be getting this error because you renamed your project and Tests
cannot be found anymore. This is easy to fix:
Solve it in Xcode like this:
- Select your project from the project navigator.
- Select
[Your project's Tests]
under targets - Under
General
tab change theHost Application
from the drop down - Build and run.
This problem happened to me because I renamed my project and the tests could't find it anymore.
Solution 2 - Ios
The problem is that after renaming the product its Tests target is still looking for the previous app name.
Select your Tests target and then in Build Settings modify the TestHost values to correspond your new product name in the following way:
$(BUILT_PRODUCTS_DIR)/YourNewProductName.app/YourNewProductName
Solution 3 - Ios
I had a similar problem -- it's because I was using Cocoapods and had opened the .xcodeproj file instead of the .xcworkspace file... doh!
Solution 4 - Ios
I have solved it by renaming the product.
In the Application's target choose Build Settings.
Under the Packaging options, you have to rename your product to the name thats shown in the error.
It solved my problem and the code started compiling. My test cases are also executing.
Solution 5 - Ios
Did you try cleaning up your derived data?
Xcode5->Organizer->Projects->Select your project->Delete the derived data.
Solution 6 - Ios
Try to remove "Social_EventsTests" target.
Solution 7 - Ios
- Goto Build settings of your tests named PuzzleGameTests.
- Go to Testing settings, write $(BUILT_PRODUCTS_DIR)/PuzzleGame.app/PuzzleGame
- Clean and build
Note: PuzzleGame is new name of my project(product name). RandomNumber is old name of my project(product name).
Solution 8 - Ios
I had issue with "framework not found". It was after renaming my project.
Go to Project settings, select the target (not the project). In the General tab, find "Linked frameworks and libraries", and delete the old name.
Solution 9 - Ios
I encountered similar problem while adding FBSDKCoreKit.framework
and solution was :
- If
frameworks
already added then remove it with optionremove all references
. - Drag & drop
frameworks
straight in thegroup
you want it to put in project. - do not re-drag or change its location afterwords
Note: When we drag & drop frameworks in xcode it automatically set framework search path under <yourproject> -> Targets -> <yourproject> -> Search Paths -> Framework Search Paths
.
once we relocate the frameworks, the Framework Search Paths
becomes empty and it results in linker error , framework not found
.
Solution 10 - Ios
Had similar kind of problem when I added unit test target to my existing project. Got all sorts of error. Had to run through some loops to get it finally running. Listing them below
-
Make sure your entry under Header search path for test target matches that for Header Search Path in your main project folder
-
If you are using pods you might run in some error such 'No Module found Firebase'. For this simply add the following lines of code to your pod file and run pod install
target 'YourProjectNameTests' do
inherit! :search_paths
\# Pods for testing
end
-
If you also get Bridging header file not found error like I did make sure you add the same for your test target in Build settings under Swift compile code general
-
Also you will have to follow the steps mentioned by @Jose Llausas