34

I'm getting these messages:

ld: warning: directory not found for option '-F"/Users/joel/Development/GHaikuTabbed"'
ld: warning: directory not found for option '-F"/Users/joel/Development/GHaikuTabbed/../../../Downloads"'

But when I go to Build Settings (as suggested at ‘ld: warning: directory not found for option’), Library Search Path and Framework Search Path are empty, so there's nothing to delete.

Thoughts on other things I can do to get rid of this warning?

Community
  • 1
  • 1
Joel Derfner
  • 2,207
  • 6
  • 33
  • 45
  • Any luck with this? Ran into the same problem yesterday and haven't figured it out. Tried a bunch of suggestions that I found on SO. – mservidio Oct 07 '13 at 00:49
  • Well, two days ago I tried again and suddenly the paths were no longer empty, so I could delete them. So maybe the answer is try again later? – Joel Derfner Oct 16 '13 at 18:01
  • I know this is an old question, but still plagues Xcode 7 users: Be especially careful which "target" for which you get this error. Frequently, for example, when upgrading to Xcode 7, it introduces this error in the "Tests" target, and people often focus on the path settings for the wrong target. – Rob Sep 28 '15 at 19:38

10 Answers10

60

Here is a description how to avoid a problem based on Apple Dev Forum posted before. It works for me so I repost description for those people who don't want to go and register at the forum.

The bug is due to an error in XCode 5 when it deals with the user adding new files or folders to the project.

Xcode is modifying the 'Library Search Paths' build setting, and making a god-awful mess of it. Instead of adding $(SRCROOT)/ it is adding fully rooted paths to all new items, and adding random amounts of /// into other elements of the string. It also seems to be duplicating source paths in some instances, probably because it's broken the existing ones, and thinks they need adding again.

The solution:

  1. Copy out your Library Search Paths string into a text editor.
  2. Remove any fully rooted paths that shouldn't be there, and replace them with the usual $(SRCROOT)/MyFiles/ type paths.
  3. Remove all extraneous slashes and make sure each path has a " character at beginning and end to protect against spaces in filenames.
  4. Paste the edited string back into Build Settings.
  5. Clean, then Build. Should be back to normal.

This error may well recur if you add new files to your project, so beware.

user2963906
  • 616
  • 5
  • 3
  • 6
    Additional note from that thread that gave me a lot of trouble: no backslashes to escape your quotes! `For my case there were some duplicate entries on the Library Search Paths and I had to get rid of one of them and I made sure the path entries start with a double quote and end with a double quote. Sometimes the quotes could be escaped with a backslash; make sure to remove the backslash if you see them there.` – thegrinner Dec 04 '13 at 21:00
  • 2
    That's exactly what happened to me. Mine was using \"$(SRCROOT)/Myfiles\" for no reason and it fixes the problem after removing the \" – zeroliu Dec 10 '13 at 09:35
  • fantastic! this worked. i was having loads of problems on GIT server, this looks like it helped. – Felipe Jan 23 '14 at 19:23
  • I wish I could mark this as the answer because this saved my day. My co-worker added a new library to our project, and when I did a pull from GIT and tried to build I got the very non-descriptive error "linker command failed with exit code 1." Turned out the Framework Search Paths were now using the full path to the folder on my co-workers computer. – SeanT Feb 21 '14 at 20:58
  • 2
    I second the fact that removing the leading \ before the quotes solved the issue. It seems that adding a new sdk in xcode 5 corrupts the library path. awesome feature. – edhnb Feb 26 '14 at 17:17
  • i agree i can see in xcode 5.1 with lots of /////.I just removed(took back up of the code working in xcode 5) my external frame work/.a file from build phases->>link binary with libraries.Quit Xcode.Again added clean and looked into the warning, here i got a warning message asking to update project to recommended setting.clicked ok and yes it solved y problem.Also in library search path extra ///// was removed. – maddy Mar 24 '14 at 07:59
  • This answer really helps! In my case I have to replace the ${PROJECT_DIR} with ${SRCROOT} for the newly added path for lib.a files. – CodeBrew Mar 24 '14 at 17:41
  • 2
    In my case, I had just added Flurry to my project. I dropped the entire SDK under my project folder and included libFlurry....a. The path to libFlurry has a lot of spaces in it. All worked fine until I closed and re-opened Xcode (5). Library Search Paths ended up with an entry for each part of the path broken along the spaces. Reassembled the path and enclosed it in quotes to correct. – Dan Loughney Apr 04 '14 at 02:42
  • There is no Library Search Paths string (its empty, like the original question), what should I do? – Rodrigo Ruiz Nov 05 '14 at 00:25
  • @DanielLoughney same exact thing happened to me.. Flurry path was shattered into a comma-separated-value series of strings. Bah!! – Tom Pace Nov 06 '14 at 16:50
5

My project.pbxproj looked like this:

LIBRARY_SEARCH_PATHS = (
        "$(inherited)",
        "\\\"$(SRCROOT)/AdMob-v6.4.1\\\"",
        "/MyProject/AdMob-v6.5.1",
); 

I closed MyProject, deleted the line containing AdMob-v6.4.1, reopened the project, performed a "validate project settings", cleaned, and built, and now all is well.

QED
  • 9,803
  • 7
  • 50
  • 87
4

Yeah, Xcode is jenky sometimes.

Did you try cleaning your build (Product > Clean Build Folder / Shift-Cmd-K) and trying again?

Another thing you can do is to search for the two entries in [project_name].xcodeproj/project.pbxproj, remove them, close XCode, re-open, Clean Build Folder and try again.

Good luck!

Keith Smiley
  • 61,481
  • 12
  • 97
  • 110
Wood Guardian
  • 559
  • 5
  • 6
4

To summarise what @user2963906 is suggest, I show my solution to this problem, which I think much easy.

I assume that you have all your files and libraries in your project folder.

  1. Open your project Targets
  2. Find Search Paths topic and Library Search Paths
  3. Choose and remove all paths here
  4. Then add path like this: $(SRCROOT)/"Your App Name"
  5. In the same window change drop-down list from the right from non-recursive to recursive
  6. Shift-⌘-K and Run your project
Dima Deplov
  • 3,688
  • 7
  • 45
  • 77
2

I found a solution for this with my case on the iOS Developer Forums. It happened to me with Xcode 5. See Massive Linker Error Warnings (directory not found for option) yet . For me it was caused by Xcode 5 junking up the "Library Search Paths" build setting.

mservidio
  • 12,817
  • 9
  • 58
  • 84
1

Easy Solution :

It's work for me

when you want to add new files or folders to the project through xcode 5 and above error display.Just follow below simple step.(Please don't forgot to get backup of your project).

  1. Open your Project in Old XCode (I recommend XCode 4.6.3)
  2. Add your files or folder. (it will not mess your library search path as it mess in XCode 5)
  3. Close the old xcode and open your project with XCode 5 and start to code.
Pratik B
  • 1,599
  • 1
  • 15
  • 32
1

I faced the same problem but was unable to fix it as per the steps since no library folders were getting displayed in the Project properties window.

So I solved it in another way (you need to be able to use the Terminal and the VIM editor. Also take a backup of the project just in case)

  1. Open a Terminal window
  2. Go to the project folder.
  3. The XCode project is a folder. use cd project name to go into that folder.
  4. use vim to open and edit the project.pbxproj file.
  5. Remove reference to the offending lines by searching using / and using the dd command on that line to delete it.
  6. Save using :wq command

Open the project in XCode and build. Works like a charm.

Karthick
  • 275
  • 1
  • 4
  • 14
1

I had to escape any spaces with a \

So for example:

/Users/Me/Folder\ with\ spaces\(and\ brackets\)

in Library Search Paths

rharvey
  • 1,987
  • 1
  • 28
  • 23
0

This worked for me :

Create this real directories (with no content), add them to project, remove via remove reference, clean, delete for real

Peter Lapisu
  • 19,915
  • 16
  • 123
  • 179
0

In project folder -> target , under 'Build Setting' search 'library search paths' and simply delete previous path in Debug & Release area.

Now add the line below line using + symbol

$(PROJECT_DIR)/Library

Note: After adding the above line click out from popup. its automatically display the full path.Then check this path with your Finder if any correction add after the $(PROJECT_DIR)/

Clean , Build and Run … Simple its cleared that error. :)

-Anup

Anuprabha
  • 181
  • 1
  • 6
  • Hi and welcome to stackoverflow. Why did you felt the need to answer something that has already been answered and accepted almost 1 year ago? – Hugo Sereno Ferreira Aug 30 '14 at 00:36
  • Hi @HugoSFerreira as I am new for this site thank you for invites and it seems every answers is different for the same question. In my case, very recently I face this issue but none of these answers worked but the problem resolved using the steps exactly what I have answered. So I thought, u know very well that answers vary depends on Xcode version, no matter when it was post but it may help somebody. Thatsy... – Anuprabha Sep 05 '14 at 07:34