ld: file not found: linker command failed with exit code 1
Asked Answered
P

12

62

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
Pinkham answered 30/10, 2014 at 23:29 Comment(2)
Are you using any third-party frameworks?Syllabism
It looks like you've made a mistake adding the Facebook SDK to your project.Syllabism
C
220

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:

  1. Select your project from the project navigator.
  2. Select [Your project's Tests] under targets
  3. Under General tab change the Host Application from the drop down
  4. Build and run.

Screenshot

This problem happened to me because I renamed my project and the tests could't find it anymore.

Carboloy answered 27/4, 2015 at 4:55 Comment(2)
Thank you. This helped me after I renamed my project and the tests wouldn't run.Stagemanage
Way better than editing the test host settings by hand.Chuckchuckfull
N
29

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
Nutrient answered 19/2, 2015 at 0:3 Comment(1)
Works! Thanks a lot dude. I just want a pint one more thing, I faced this error after renaming Project.Welkin
L
16

I had a similar problem -- it's because I was using Cocoapods and had opened the .xcodeproj file instead of the .xcworkspace file... doh!

Lepidosiren answered 27/7, 2016 at 15:49 Comment(1)
ah! Alhamdulillah, At last I have overcome, after 8 hours struggle ! You saved my night you saved my day.Humanitarianism
C
13

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.

Culm answered 10/11, 2014 at 6:57 Comment(2)
this solved my error. but i need to chaange product name. when i change its product name. it give me the same error. please help me?Hyperphagia
@IbadUrRahman in order to solve this issue you must keep the product name and the name shown in the error as same.But if you want to change the display name of the application, you can do it by renaming the bundle display name in the info plist.Culm
M
4

Did you try cleaning up your derived data?

Xcode5->Organizer->Projects->Select your project->Delete the derived data.
Myoglobin answered 10/11, 2014 at 7:7 Comment(0)
O
2

Try to remove "Social_EventsTests" target.

Oversubscribe answered 1/11, 2014 at 12:26 Comment(0)
L
2
  1. Goto Build settings of your tests named PuzzleGameTests.
  2. Go to Testing settings, write $(BUILT_PRODUCTS_DIR)/PuzzleGame.app/PuzzleGame
  3. Clean and build

Note: PuzzleGame is new name of my project(product name). RandomNumber is old name of my project(product name).

Loyalist answered 28/4, 2015 at 15:48 Comment(0)
K
2

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.

Kazukokb answered 27/6, 2017 at 17:26 Comment(1)
Excellent! Re-adding the correct one was easy using the + buttonIceland
I
0

I encountered similar problem while adding FBSDKCoreKit.framework and solution was :

  1. If frameworks already added then remove it with option remove all references.
  2. Drag & drop frameworks straight in the group you want it to put in project.
  3. 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.

Impatience answered 15/1, 2016 at 6:37 Comment(0)
C
0

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

  1. Make sure your entry under Header search path for test target matches that for Header Search Path in your main project folder

  2. 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

  3. 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

  4. Also you will have to follow the steps mentioned by @Jose Llausas

Comprehensive answered 7/6, 2017 at 8:31 Comment(0)
S
0

I had similar kind of problem when I added a framework to my project.

I have resolved the issue by removing the framework and again adding the framework to the project by dragging and dropping the framework file to the projects frameworks folder and selecting the Copy items if needed option.

enter image description here

Soapbox answered 18/7, 2020 at 11:42 Comment(0)
A
0

Try

pod deintegrate

followed by

pod install

This worked for me (installing hermes-engine took like 5 mins).

Ames answered 26/4, 2024 at 7:20 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.