‘ld: warning: directory not found for option’
Asked Answered
P

32

564

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

Peritonitis answered 27/2, 2012 at 0:39 Comment(5)
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.Holism
Note: Make sure directories with spaces are quoted. eg $(PROJECT_DIR)/my folder should be`"$(PROJECT_DIR)/my folder"Mummer
I ran into this issue when my class did not have the proper target membership specified.Romanist
@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. ThanksSaturate
Regular backup is best practice.Glucoside
E
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.

Enrollee answered 27/2, 2012 at 0:48 Comment(19)
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 :)Begga
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!Doubtful
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.Citreous
@Citreous Agreed. Make sure you aren't deleting something that is needed. In my case, it had "DerivedData" in the path, which was completely useless.Wither
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)Modular
Check this user: #9064879 Both answer don't work for me. the respectively 2 errors still remain.Isborne
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 ?Eugenie
I had to delete the paths under 'Framework Search Paths' on my 'AppTests' TARGET to clear the error.Haggerty
The content in 'Library Search Path' is empty in my case what to do?Sublime
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)?Rosaleerosaleen
I don't have any listed paths in Library Search Paths.Tequilater
@Modular What did you do to solve this? This answer created an error for me as well :-(Oversubscribe
This created an clang error in my code. ld: library not found for -lFDMobihelpSDKOversubscribe
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.Sundog
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...Fabrizio
For those seeing the error @Modular saw... make sure you open and build the workspace instead of the project.Zinnia
This broke my project! I put $(inherited) to work again.Ungulate
in my project its already deleted but still i am facing the same problem please help me the sameLiegnitz
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?Endogamy
S
771

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.

Saturate answered 4/9, 2013 at 15:40 Comment(11)
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.Uprush
on delete the Search Paths it again shows FacebookSDK not found. It is a -F error. I am using Xcode 6.1Campstool
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).Mabellemable
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.Irrational
If they still don't go away after doing the above instructions, try cleaning/clean build folderOryx
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...Hypnos
@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...Oldline
Thank you @Oldline 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.Hypnos
Thank you much for "-L is for Library Search Paths" and "-F is Framework Search Paths" guideline, it worked perfect for me.Casandracasanova
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 ?Kasten
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 PathsSulfite
R
87

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

Renshaw answered 10/11, 2016 at 15:9 Comment(0)
R
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. :)

Rosenbaum answered 21/3, 2013 at 2:1 Comment(0)
D
23

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

pod install

again and reopened the project. This fixed everything!

Deprecate answered 29/12, 2016 at 1:16 Comment(4)
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.Neldanelia
Also, cocoa pods generates a workspace. make sure to open that, not the project file. pod install + open the workspace file fixed my problem.Parotid
In ionic this works for me when I ran the pod install inside the platforms/ios folderPiracy
Thank you for sharing this, it worked for me as well.Fistula
C
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
Corky answered 1/4, 2014 at 3:28 Comment(4)
This is the perfect answer! Tested April 2014Boesch
It's pathetic that this is still broken in Xcode 6, Feb. 2015. Spaces in paths should not need to manually be escaped.Lobachevsky
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!Irrational
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.Consubstantiate
N
16

I found the reference which I had to remove at:

  • Target
  • Build Settings
  • Header Search Paths
Northern answered 12/2, 2013 at 14:40 Comment(1)
Using Google to find a solution for ‘ld: warning: directory not found for option’, finding my own answer as solutionNorthern
A
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

Adamski answered 6/11, 2014 at 19:45 Comment(0)
B
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

Biometrics answered 20/10, 2015 at 18:0 Comment(1)
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!Stadiometer
O
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)"
Ornery answered 1/10, 2017 at 16:26 Comment(0)
S
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.

Satiable answered 13/1, 2014 at 22:0 Comment(2)
HUGE +1 for this. Those escapes on the " were the cause of the "directory not found" error for both -L and -F options.Rizzi
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 pathsMauldin
P
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

Pram answered 24/1, 2017 at 8:33 Comment(1)
Could be that you opened the project file instead of the workspace.Aerodynamics
F
4

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

Fullblooded answered 3/9, 2020 at 19:6 Comment(0)
L
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.
Lab answered 1/5, 2015 at 15:57 Comment(0)
U
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.
Unimpeachable answered 23/7, 2015 at 5:40 Comment(2)
I want to try this, but Im worried it will break the app. Are you sure everything worked after you did this?Bloodstained
@Bloodstained 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.Unimpeachable
N
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

Nik answered 21/2, 2020 at 16:27 Comment(0)
S
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)

Shoelace answered 21/4, 2013 at 2:8 Comment(0)
O
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

Oscillator answered 7/5, 2013 at 21:20 Comment(0)
S
1

go check out which framework is missing , then go to

=> Build Phases => Link Binary With Libraries

remove the library and then add back

Sinclair answered 28/5, 2014 at 8:31 Comment(0)
L
1

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

Ledezma answered 19/8, 2015 at 11:40 Comment(0)
S
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!

Sackville answered 21/1, 2016 at 8:59 Comment(0)
C
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.

Conspectus answered 13/9, 2018 at 7:18 Comment(0)
D
1

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

Dozen answered 9/7, 2019 at 13:10 Comment(0)
L
1

enter image description here

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

Lehrer answered 29/10, 2019 at 9:59 Comment(1)
The above solution is working fine for me, If It is not working for you, please share the screenshot.Lehrer
R
0

you should check option for this:

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

Redskin answered 20/7, 2015 at 8:33 Comment(0)
D
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.

Daffi answered 10/1, 2016 at 6:11 Comment(0)
G
0

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

worked for me.

enter image description here

Glossectomy answered 12/1, 2017 at 13:30 Comment(0)
F
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.

Fairway answered 7/4, 2017 at 7:59 Comment(0)
C
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.

Conducive answered 19/2, 2020 at 1:6 Comment(0)
T
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

Trenatrenail answered 12/9, 2020 at 8:40 Comment(0)
S
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'
Sundae answered 8/11, 2020 at 4:35 Comment(0)
O
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.

Ordway answered 22/4, 2021 at 17:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.