562

When I'm building my Xcode 4 apps I'm getting this warning:

ld: warning: directory not found for option '-L/Users/frenck/Downloads/apz/../../../Downloads/Google Analytics SDK/Library'
ld: warning: directory not found for option '-L/Users/frenck/Downloads/apz/../Google Analytics SDK/Library'

But I do not have Google Analytics in my app, I deleted all of it how can I remove the error? And archiving an app gives me the error:

clang: error: no such file or directory: 'armv6'
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

I've tried so many things but I'm still getting this error when I'm trying to make an .IPA file

Teepeemm
  • 4,331
  • 5
  • 35
  • 58
Frenck
  • 6,514
  • 5
  • 22
  • 25
  • 10
    Note that there is a very similar warning, but with `-F` rather than `-L`: `directory not found for option '-F/...`. See @macayer's answer below for the difference. – pkamb May 08 '14 at 20:37
  • 1
    Note: Make sure directories with spaces are quoted. eg `$(PROJECT_DIR)/my folder` should be`"$(PROJECT_DIR)/my folder" – Jacksonkr Sep 17 '14 at 22:44
  • I ran into this issue when my class did not have the proper [target membership specified](http://stackoverflow.com/a/16436604/1803879). – Tom Howard Oct 08 '15 at 16:06
  • 1
    @Jackson That fixed it for me. I had the -F warning, and I fixed it by quoting as you instructed in the 'Framework Search Paths' in Build Settings. Thanks – Mark Oct 14 '15 at 16:52
  • Regular backup is best practice. – Gajendra K Chauhan May 25 '16 at 09:05

32 Answers32

958

You need to do this:

  1. Click on your project (targets)
  2. Click on Build Settings
  • if your error includes the -L flag, then delete the values in Library Search Paths
  • if your error includes the -F flag, then delete the values in Framework Search Paths

And regarding the second error, sorry i can't help you out with that one. Hope someone else can help you out.

Blazer
  • 14,259
  • 3
  • 30
  • 53
  • 5
    This broke my project, but I just commented out my Google Analytics #imports and deleted the SDK, quit xcode, re-added and uncommented my #imports and it worked again :) – emotality May 06 '13 at 10:56
  • 1
    Are there any steps you've omitted? I did this and now Xcode can't find a bunch of other files that were working seconds before. Help! – user Jun 20 '13 at 22:47
  • 9
    Be careful of deleting if you actually need that library path. Verify that the path specified in the error exists. The location of the library on disk may have been moved. – AWrightIV Sep 17 '13 at 21:59
  • 1
    @AWrightIV Agreed. Make sure you aren't deleting something that is needed. In my case, it had "DerivedData" in the path, which was completely useless. – migs647 Mar 26 '14 at 00:54
  • 3
    After delete **Library Search Paths** I got the error: `ld: library not found for -lMoboSDK clang: error: linker command failed with exit code 1 (use -v to see invocation)` (lMoboSDK is my static library) – lee Jun 16 '14 at 04:54
  • Check this user: http://stackoverflow.com/questions/9064379/glew-apple-mach-o-linker-id-error Both answer don't work for me. the respectively 2 errors still remain. – Aerox Jun 25 '14 at 22:16
  • This works for me but then I have to do this every time when I start the xcode. first delete search path and library file then include library file. How I can solve that permanently ? – Varun Naharia Jun 21 '15 at 05:11
  • 2
    I had to delete the paths under 'Framework Search Paths' on my 'AppTests' TARGET to clear the error. – AT3D Oct 09 '15 at 10:22
  • 1
    The content in 'Library Search Path' is empty in my case what to do? – Jayprakash Dubey Jan 12 '16 at 11:32
  • 1
    Could you expand on why this works, and issues with it that we need to be aware of (such as potentially unwanted side-effects of deleting the paths)? – Matt Fenwick Mar 16 '16 at 15:31
  • 1
    I don't have any listed paths in Library Search Paths. – Ezekiel Victor Sep 11 '16 at 03:12
  • @lee What did you do to solve this? This answer created an error for me as well :-( – Kunal Gupta Dec 22 '16 at 13:04
  • This created an clang error in my code. ld: library not found for -lFDMobihelpSDK – Kunal Gupta Dec 22 '16 at 13:08
  • If you have deleted this framework dependency and the path includes anther frameworks that you need to delete it. In my case i had this sub path in which my deleted framework was in. – Amjad Husseini Dec 10 '17 at 12:21
  • My Xcode project (which was building fine until Xcode demanded I upgrade, to be able to connect to my upgrade iOS 11 iPhone) built fine before the upgrade. Now, I get this "folder not found" error, even though I don't have *anything* listed under "Library Search Paths" or "Framework Search Paths". I loathe this environment *so* much... – Mike Gledhill Dec 11 '17 at 09:09
  • 2
    For those seeing the error @lee saw... make sure you open and build the workspace instead of the project. – psilencer Jun 20 '18 at 00:05
  • 1
    This broke my project! I put $(inherited) to work again. – diegodsp Jul 22 '19 at 17:37
  • in my project its already deleted but still i am facing the same problem please help me the same – sherkhan Sep 06 '21 at 08:53
  • I had the same issue, so I deleted the `Framework Search Path` values. Now, however, I am getting a `Framework not found AppAuth` error. Do I need to add back in some form of value for the `Framework Search Paths`? – John Sorensen Nov 06 '21 at 02:05
770

There are two errors that people seem to be confusing.

If it is a "directory not found for option '-L/..." error, that means it's a Library Error, and you should try to:

  • Click on your project (targets)
  • Click on Build Settings
  • Under Library Search Paths, delete the paths

If it is a "directory not found for option '-F/...", that means it's a Framework Error, and you should try to:

  • Click on your project (targets)
  • Click on Build Settings
  • Under Framework Search Paths, delete the paths

This might happen when you move the referenced file around.

Dave Liepmann
  • 1,555
  • 1
  • 18
  • 22
Marc
  • 11,341
  • 3
  • 27
  • 30
  • 3
    Why can't all answers be as concise and helpful as yours? Thank you. I have a side question: where does one learn about the cryptic -L/-F errors? I'm new to the whole linking/compiling/building game, and Xcode's built-in documentation isn't exactly something to write home about. I'm assuming most of this stuff can be accessed via command line. Am I right in this assumption? It's just been difficult for me to even know where to begin with all this stuff. I'm used to web development, so as you could assume, finding info in that realm is a bit easier. – Ben Stock Aug 26 '14 at 00:22
  • on delete the Search Paths it again shows FacebookSDK not found. It is a -F error. I am using Xcode 6.1 – Rinku Jan 25 '15 at 17:30
  • Worked for me. I had to delete framework search paths in the targets for both the project and the testing module (upon project upgrade from iOS8.3 to iOS9). – ObjectiveTC Jul 03 '15 at 01:07
  • 2
    Come on Apple, what happened to "it just works" ... this should apply to dev too. At least offer us suggestions on how to resolve these sort of issues instead of these cryptic messages. Kinda reminds of Microsoft, ew. – John Contarino Jul 10 '15 at 17:47
  • If they still don't go away after doing the above instructions, try cleaning/clean build folder – MendyK Aug 28 '15 at 18:11
  • I have no search paths in Library nor in Framework in the Build Settings but still I get the -F error. I have already cleaned and rebuilt the project a couple of times. I have no spaces in the path to my project. But I do have `@executable_path/Framework` on "Runpath Search Paths" and if I take it out, I get [this](http://stackoverflow.com/questions/32771796/dyld-library-not-loaded-rpath-libswiftavfoundation-dylib)... – Gobe Dec 25 '15 at 22:11
  • @MarceloGobetti, you've probably already sorted it but just in case: I had the same issue - it appeared that the offending framework wasn't in any search path but in fact by double-clicking on the 'Framework Search Paths' in 'Build Settings' the pop-up window showed two entries and one of them was the missing framework header location. I deleted this and all is well. This probably counts as a bug in Xcode as only one entry is ever shown in the Search Paths entry... – Todd Jan 21 '16 at 13:26
  • Thank you @Todd but unfortunately I had already done that and actually I have no search paths at all in the Framework Search Paths. I'm also counting this as a bug, and as it is just a warning, I am currently ignoring it. – Gobe Jan 24 '16 at 16:51
  • 2
    Thank you much for **"-L is for Library Search Paths" and "-F is Framework Search Paths"** guideline, it worked perfect for me. – swiftBoy Feb 29 '16 at 07:33
  • i have the same error after updating my xcode to 8.3.2 . i have followed all the possible solutions given everywhere , but the error still persist . what to do further ? – Moxarth May 16 '17 at 09:49
  • This can also happen for the -F flag after moving/removing-then-readding an embedded framework that then gets unfortunately listed twice in the Framework Search Paths – uchuugaka Oct 25 '19 at 04:17
86

My problem was that I opened the original .xcodeproj instead of the .xcworkspace that was generated by CocoaPods.

lujop
  • 13,504
  • 9
  • 62
  • 95
67

I had to remove the references at:

  • Target
  • Build Settings
  • Framework Search Paths

enter image description here

Then the build was broken (expected). So I removed the Framework (FB SDK), re-added it and voila. No more errors or warnings. :)

backslash-f
  • 7,923
  • 7
  • 52
  • 80
23

I use cocoa pods so for me, I quit Xcode and ran

pod install

again and reopened the project. This fixed everything!

Lazar Kukolj
  • 696
  • 3
  • 15
  • 43
  • 1
    Not sure why you're being downvoted when your suggestion can actually be a solution to a similar issue! Specifically, it is a solution if you're experiencing similar error messages after adding new build configuration to your project. Since adding new build configuration automatically implies duplicating an existing configuration, you need to run `pod install` to adjust the “Based on Configuration File” column value. – Cellane Mar 20 '17 at 08:38
  • 1
    Also, cocoa pods generates a workspace. make sure to open that, not the project file. pod install + open the workspace file fixed my problem. – Michael Krebs Jun 17 '18 at 14:43
  • In ionic this works for me when I ran the pod install inside the platforms/ios folder – Bas van Dijk Nov 14 '18 at 15:02
  • Thank you for sharing this, it worked for me as well. – Ibrahim Azhar Armar Apr 20 '21 at 18:33
19

For me the problem was a missing escape "\" character.

My search paths were broken up on several lines in the Library Search Paths. Conveniently, they were breaking at spaces in my path. Adding the escape "\" fixed it for me.

$(PROJECT_DIR)/My\ Project\ Name/My\ Directory
Iron Mike
  • 335
  • 3
  • 6
  • This is the perfect answer! Tested April 2014 – Van Du Tran Apr 14 '14 at 07:48
  • 1
    It's pathetic that this is still broken in Xcode 6, Feb. 2015. Spaces in paths should not need to manually be escaped. – StilesCrisis Feb 19 '15 at 08:02
  • The accepted and higher voted answers above did not work for me, but this did. My hint that it was this issue is that Xcode was throwing 2 -L errors, with each error being a fragment of the complete path and it was breaking on the space. Agreed that in 2015 we shouldn't have to worry about escaping spaces, that should be handled behind the scenes for us! – John Contarino Jul 10 '15 at 22:46
  • Yeah, this is a long-standing issue in Xcode that occurs when your search path is added automatically by the system (i.e. due to dragging a library into 'embedded binaries' - for some reason it doesn't escape the spaces automatically and subsequently interprets them as separate file paths. – Ash Sep 18 '15 at 09:23
16

I found the reference which I had to remove at:

  • Target
  • Build Settings
  • Header Search Paths
Jasper
  • 7,031
  • 3
  • 35
  • 43
  • 47
    Using Google to find a solution for ‘ld: warning: directory not found for option’, finding my own answer as solution – Jasper Jun 18 '15 at 15:31
15

In my case the problem was Framework Search paths that had incomplete, dead, old links or multiple frameworks of same type. Remove them and your project will compile without any problem.

be sure to do Build -> clean

enter image description here

Sam B
  • 27,273
  • 15
  • 84
  • 121
12

I ran into the same problem (the first one) after an Xcode crash and none of the solutions proposed worked. To suppress the warning I have done:

• manage schemes...

• deleted the current scheme

• Autocrate Schemes Now

Francesco
  • 231
  • 3
  • 11
  • We should have the author of this original question post a Note to run through all of these solutions. A list. Try first one, second next solution, next solution... because this did it for my migration of an older project and other solutions are reasonable solutions. If I did not try out all , I would not have found this one... moved on and been swimming in confusion. Thx Francesco! – Matthew Ferguson Mar 26 '17 at 21:52
10

This is what worked for me:

  1. Click on Project
  2. Click on Build Settings
  3. Search for "Framework Search Paths"
  4. Clear the path and type "$(inherited)"
Major MacGregor
  • 101
  • 2
  • 9
6

I got bit by what appears to be the same issue too (this time in XCode 5.0.2). In my case, what happened was XCode decided to escape the quotes already in the "Build Settings". So for example:

"$(SRCROOT)/../GoogleAdMobAdsSdkiOS-6.4.1"

became

\"$(SRCROOT)/../GoogleAdMobAdsSdkiOS-6.4.1\"

which caused the build to fail...

Once I removed the escapes on the quotes everything worked fine again. In addition, it would probably be best to remove the quotes altogether unless you need them.

Brad Folkens
  • 966
  • 1
  • 7
  • 9
  • 1
    HUGE +1 for this. Those escapes on the " were the cause of the "directory not found" error for both -L and -F options. – Will Feb 07 '14 at 00:10
  • 1
    very useful tip...in my project xcode 5.0.2 escaped quotes in the beginning, middle and end of paths....it had also duplicated paths for some frameworks in a weird way...removed escapes, let just "real frameworks paths" for the ones the project is using and got rid of warnings...it also was necessary to remove / add again frameworks after correcting the paths – Marcos Reboucas Mar 04 '14 at 23:00
6

If this happens after you've added a Podfile to your project and run pod install, go to your project folder, you'll see a new file that has been created "{ProjectName}.xcworkspace" -- open that file in xcode

The pods that have been installed will be properly linked to your project in this file

4

there might be a mismatch in deployment targets. pods are installed for 11.0 and the Xcode is searching in 10.0 folders

Madhu Kumar
  • 395
  • 3
  • 11
3

Follow this step-by-step solution:

  1. Click on your project (targets);
  2. Click on Build Settings;
  3. Under Library Search Paths, delete the paths;
  4. Add ./** on Library Search Paths.
Cesare
  • 9,139
  • 16
  • 78
  • 130
krishna
  • 59
  • 1
  • 2
3

Supplemental answer

All the answers said to either delete the Framework or Library search paths from the target. I had two problems:

  • First, I was looking at my main project target rather than the Unit Test target.
  • Second, I couldn't figure out how to delete the framework search path. It turned out that it was just clicking it to get in edit mode and then just deleting the string.
Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
  • I want to try this, but Im worried it will break the app. Are you sure everything worked after you did this? – Supertecnoboff May 26 '16 at 15:23
  • @Supertecnoboff If you are worried that it won't work, then save the string before you delete it. You can always paste it back in. My app was already broken, so I just had to keep trying things until something worked. My answer above is what worked for me. – Suragch May 27 '16 at 03:44
2

If this happens after a pod install with some dependencies, the problem might be you are using the old version of the app(.xcworkspace) on Xcode.

After a pod install, this is the output you may see.

The output of a pod install.

Output of a pod install

Do exactly that, close your current Xcode window and open the new .xcworkspace.

Opening the new xcworkspace]

Opening the new xcworkspace

JJIqbal
  • 630
  • 1
  • 8
  • 23
1

For me the problem seemed to be that I hadn't included the appropriate frameworks (when copying addons from another project I didn't copy the frameworks files as well)

studiou
  • 301
  • 3
  • 6
1

The key for this type of error is to go into build settings and look at each of the search paths sections such as Library Search Paths, Framework Search Paths and possibly even Header Search Paths and clear out any of the paths that no longer apply that your app is having a hard time trying to find. Remove them and carry on good sir

Chris Klingler
  • 5,258
  • 2
  • 37
  • 43
1

go check out which framework is missing , then go to

=> Build Phases => Link Binary With Libraries

remove the library and then add back

chings228
  • 1,859
  • 24
  • 24
1

I had a similar problem that went away when I created a new scheme and used it to rebuild???

prankin
  • 1,784
  • 1
  • 14
  • 5
1

For me I have also Tests enabled. The search path for tests was also filled incorrect.

Clear the Framework Search Path for both the regular code and the test code!

Vincent
  • 4,342
  • 1
  • 38
  • 37
1

Because of the custom directories that have entered to the search paths ( frameworks and library ), the project overrides pod's directories. so it can't find it.

To solve this problem, delete all custom directories from

Search Paths -> Library Paths and Framework Paths,

only see ${inherited}.

I hope this helps. It worked for me.

1

If you installed any new pod and then got this error, just quit the xcode > open again > build the project

Viral Savaliya
  • 180
  • 3
  • 5
1

enter image description here

Add $(inherited) -Objc -lcrypto - lssl in Project -> Build Setting -> Search path -> Library Search Path

James Wong
  • 4,529
  • 4
  • 48
  • 65
Bandish Kumar
  • 1,557
  • 1
  • 9
  • 13
0

you should check option for this:

Build Settings-> Framework Search Paths-> {input Your Project Path}

0

I've looked into all [Library Search Paths - Framework Search Paths - Header Search Paths]. but there are no paths to remove, so I was able to make this alert go away by going into the Xcode bundle and creating an empty directory at the path location that the alert was complaining about.

Mohammed Fathy
  • 357
  • 2
  • 10
0

Make sure only 1 "libFlurry.a" selected in target

worked for me.

enter image description here

Ofir Malachi
  • 1,145
  • 14
  • 20
0

Do not forget to create the same configuration for Pod project in your workspace, If you change into MainApps new configuration.

For example,

In my case, to resolve this issue I had to create ReleaseOfficial configuration as well for Pod projects when I created ReleaseOfficial configuration for my MainApp.

Community
  • 1
  • 1
Sazzad Hissain Khan
  • 37,929
  • 33
  • 189
  • 256
0

If the typical solution doesn't resolve the issue, what fixed it for me was ensuring that all iOS versions in the xcode project (e.g. IPHONEOS_DEPLOYMENT_TARGET) / deployment targets, podfiles (if applicable), etc. are set to the same version number.

EmpireJones
  • 2,936
  • 4
  • 29
  • 43
0

1- select your target

2- open build settings

3- search for "framework search paths"

4- delete all "framework search paths"

5- then install the pods again

6- add in the "framework search paths" $(inherited)

7- clear cmd + k

8- build cmd + b

Ahmed Samir
  • 291
  • 3
  • 6
0

I had same problem, it was due to a line I added in my pods. I used next line in post install for some errors. Just remove if you have used the same:

#config.build_settings['CONFIGURATION_BUILD_DIR'] = '$PODS_CONFIGURATION_BUILD_DIR'
PeterJ
  • 3,705
  • 28
  • 51
  • 71
Bilal Khan
  • 1,023
  • 7
  • 9
0

For me the issue was having a space in the Configuration name like "Development Debug". Once I removed the space and made it "DevelopmentDebug", the error message went away.

zeusstl
  • 1,673
  • 18
  • 19