Xcode linker Directory not found for option - xcode

Xcode 4 is throwing me a warning about directory not found for option '-L/Users/t2wu/Documents/blah blah'. Yes it shouldn't be found because I removed it. I remove the directory and I also removed the directory setting in both the target and the project library search path. I also remove the .a file which I was linking before from the "Link binaries with Libraries". It compiles fine, it just gives me the warning. Why is it still having the -L flag?

Check the Build settings tab and make sure that the "Library search paths" option is empty.
At last resort, fire up Terminal and cd to the app project directory (appname.xcodeproj) and do a fgrep for the erroneous search path. I've found some of these lurking in the project.pbxproj file; ended up editing the file manually to get rid of them. (Of course you should make a copy of the file before doing so, in case you trash the project file.)
It'd also be worthwhile to do a "clean" on the project. How to Empty Caches and Clean All Targets Xcode 4.

I had the same issue in my project, it contains multiple custom framework created by me and the project. My issue is resolved by removing 'Framework search Paths' and 'Library Search Paths' from the target which has this issue.

In my case in targets -> build settings I removed searchpaths for which errors occured. Then removed libraries from project and added them again.

You may need to clear the Search Paths for the Tests target as well as the main project. This had me stumped for a little while.

I checked the library search path
I went to Build settings -> Search Paths change the "Framework Search Paths" to $(inherited)...that solved my problem

Sometimes, this error occurs if you open Project.xcodeprojinstead of Project.xcworkspace. Check your project directory and make sure to open Project.xcworkspace.

Related

warning: directory not found for option after update to xcode 7

I have totally no idea about what does it mean:
ld: warning: directory not found for option '-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk/Developer/Library/Frameworks'
For me it ended up being in the TestTarget Build Settings.
Go to Build Settings
Click the up/down arrows next to your project name (above the Basic/All buttons) to select your Test Target
In the search bar, type in Search Paths
Delete any conflicting paths under the Framework Search Paths or Library Search Paths
Clean
Build
In my case, I had a path under Framework Search Paths pointing at Developer/Library/Frameworks
Go to Project Settings, and delete/remove excess framework paths that you don't need.
or
Click on projects
CLick on build settings and then under library search paths, delete the paths.
UPDATE:
if you cannot find it, then click on 'Find', then 'Find in Project', search 'path', you may then get the result, from there select framework search paths. you will see framework search paths. I hope this helps.
I meet a same problem.And I resolve it by https://forums.developer.apple.com/thread/3729
You can click on testsTarget and click build settings and open the Framework Search Paths to remove the warning Path.
In my project I was using Carthage to implement the Pod. The problem I was having is that I had not yet installed Carthage on my machine and it was necessary to give Build
$ brew install carthage
$ carthage build
What is working for me is:
Go to ' General ' in Xcode and click 'Embedded Binaries'
Add the .dylib and .a file to your project
Lastly, goto 'Build Settings' search for 'Other Linker Flags' ,then copy your library commad line argument and add it there.

<unknown>:0: error: unexpected input file:

I downloaded files from a separate Stack OverFlow post, and dragged the folder into my project (as a group.) The dependancies get resolved and it shows no error for code that relies on the files, but when I try to compile I get this error:
<unknown>:0: error: unexpected input file: /.../xyz.Swift
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
It might be nothing, but the files themselves in the project navigator show up as blank icons (while my project's other file have the swift red spalsh icon) despite checking in as swift files in the attribute inspector.
I've fumbled a few times with adding and deleting multiple sets of files, I checked the local dir and nothing seem out of order... is there something else that might be messing this up?
Thanks for suggestions!
Solved - The issue was with the filename extension:
xyz .Swift will not properly link. It will be processed by xcode and solve code issues expecting it, but the linker will hiccup.
renamed files to xyz .swift -> problem solved.
In my case it was after removing a compiler flag in a way it didn't like. Try to figure out what you changed in your compiler settings before it started acting weird. Sometimes because Xcode caches compiled code the problem doesn't immediately start after doing the change!
I haven't seen that precise error before, but don't add files through Finder. Start over, and this time use 'New' -> 'File...' from the Xcode 'File' menu. It has to update its internal manifests to track all project files; you don't want to subvert this process.
After that you may still need to do a 'Clean' before re-building, and perhaps remove all of the DerivedData as well while Xcode is not running:
How can I safely delete in my ~/Library/Developer/Xcode/DerivedData directory?

Xcode "directory not found for option -L" errors

I'm getting these errors:
ld: warning: directory not found for option '-L"/pathToMyApp/MyApp/Shared/Libraries/ADMS_AppLibrary"'
ld: warning: directory not found for option '-L"/pathToMyApp/MyApp/Shared/Libraries/TestFlightSDK1.1"'
ld: warning: directory not found for option '-L"/pathToMyApp/MyApp/Shared/Libraries/Medialets"'
ld: library not found for -lTestFlight
clang: error: linker command failed with exit code 1 (use -v to see invocation)
These directories do in fact exist at the paths above.
The thing is, the app used to compile fine. All I did was add a new version of the Medialets library to the project, and now I get these erros.
There are two errors that people seem to be confused about:
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 Frameworks Search Paths, delete the paths
I had the same problem when I added a new library to the project.
It seems that the linker error occurs when the Xcode 5 adds a path to "Library Search Paths" automatically when adding a new library directory to the project.
The linker error disappeared once I manually edited the paths. (I didn't essentially change the path, just tried some different formats such as $(PROJECT_DIR)/path/to/library or "$(SRCROOT)/path/to/library". It worked even after changed back to the original format.)
I think it's a bug of Xcode. I'm using Xcode 5.1 (5B130a).
For the "-L" issue,
If you are using cmake (in my case 3.3.2) and use the xcode generator, it will generate multiple entries for each link-directory you specify,
link_directories ("${PROJECT_SOURCE_DIR}/SDKs/thelib/lib")
see the cmake sourcecode, cmGlobalXCodeGenerator::AddDependAndLinkInformation(...) where it does this:
{ ...
if(this->XcodeVersion > 15)
{
// Now add the same one but append
// $(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) to it:
linkDirs += " ";
linkDirs += this->XCodeEscapePath((*libDir + "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)").c_str());
}
linkDirs += " ";
linkDirs += this->XCodeEscapePath(libDir->c_str());
}
which will result in XCode having these entries in the Lib Search Path
/Users/myuser/thelib/lib/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
/Users/myuser/thelib/lib
So that makes it a bit more difficult to get rid of this warning; Depending on your file-structure, one of those is likely going to be wrong - and even if you manually remove it they will be back next time your project is regenerated.
One work-around is to just create empty directories for the ones it complains about...
It's also possible to "pass some arguments" to the linker using "-Wl", but so far I didn't find out what to pass to silence that specific warning.
ld: warning: directory not found for option '-L"----it's a Library Error
Select your project go to the Build Settings tab,Under Library Search Paths, Replace the path with this string $(SRCROOT)
Just removing the lib from "Link With Binary With Libraries" section of "Build Phases" doesn't seem to resolve the issue in Xcode 6 at least.
1) Go to your project navigator and find the "Frameworks" folder
2) your lib is probably there already, so just right click and "Delete"
3) Select "Remove References"
4) go to your repo or project folder where all your files are and drag
it into the "Frameworks" folder
5) clean, and rebuild and the errors should go away
I did not have any added library paths under Library Search Paths, but instead I could solve this issue by deleting the Derived data, by going to Preferences -> Locations
I started seeing both -L and -F errors in the build for a react native app and none of the existing answers solved the problem.
For me the problem was I had updated the ios version in my Podfile:
platform :ios, '11.0'
but not in the xcode project.pbxproj file:
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
(The setting appears multiple times in the .pbxproj file)
Making the versions match solved the problem.

xcode library not found

I'm getting the following error:
ld: library not found for -lGoogleAnalytics
clang: error: linker command failed with exit code 1 (use -v to see invokation)
I've spent some time googling but can't find how to fix this problem. I'm new to xcode and this is an existing project that I need to work on.
In my case, the project uses CocoaPods. And some files are missing from my project.
So I install it from CocoaPods: https://cocoapods.org/.
And if the project uses CocoaPods we've to be aware to always open the .xcworkspace folder instead of the .xcodeproj folder in the Xcode.
You need to set the "linker search paths" of the project (for both Debug and Release builds). If this library was in, say, a sibling directory to the project then you can set it like this:
$(PROJECT_DIR)/../GoogleAnalytics/lib
(you want to avoid using an absolute path, instead keep the library directory relative to the project).
All in all, the Xcode cannot find the position of library/header/framework, then you tell Xcode where they are.
set the path that Xcode use to find library/header/framework in Build Settings --> Library/Header/Framework Search Paths.
Say, now it cannot find -lGoogleAnalytics, so you add the directory where -lGoogleAnalytics is to the Library Search Paths.
In my case I had a project with lots of entries in "Build Settings > Other Linker Flags"
I needed to reduce it down to just
$(inherited)
-ObjC
Old settings:
Updated settings:
For me, I open the projectname.xcworkspace file and it all works.
If you have pods installed, make sure to open the workspace folder (white Xcode icon) not the project folder. This resolved the library not found for ... error. Very simple issue but I was stuck on this for a long time.
This worked for me:
Go to build setting -> Linking -> Other Linker Flags -> Remove all other than $(inherited)
Cd ios && pod update
If you are using Pods to include the GoogleAnalytics iOS SDK into your project, it's worth noting that since the 3.0 release your Other Linker Flags needs to include -lGoogleAnalyticsServices not the old -lGoogleAnalytics
If your library file is called libGoogleAnalytics.a you need to put -lGoogleAnalytics so make sure the .a file is named as you'd expect
None of the above worked for me, what did was making sure the Pod file platform :ios, '11.0' matched with the minimum deployment target in the XCODE setting
You can also try to lint with the --use-library option, as cocoapods lint libraries as framework by default since v0.36
The problem might be the following: SVN ignores .a files because of its global config, which means someone didn't commit the libGoogleAnalytics.a to SVN, because it didn't show up in SVN. So now you try to check out the project from SVN which now misses the libGoogleAnalytics.a (since it was ignored and was not committed). Of course the build fails.
You might want to change the global ignore config from SVN to stop ignoring *.a files.
Or just add the one missing libGoogleAnalytics.a file manually to your SVN working copy instead of changing SVNs global ignore config.
Then re-add libGoogleAnalytics.a to your XCode project and commit it to SVN.
In XCode 10.1, I had to set "Library Search Paths" to something like $(PROJECT_DIR)/.../path/to/your/library
For me it was a silly thing: my mac uploaded the file into iCloud, and that is why Xcode did not find it.
If you turn off the automatic upload, it wont happen again.

I'm getting "clang: error: no input files"

I had a file which I deleted and replaced with another file, somewhere else, of the same name.
Despite cleaning, and trying this multiple times, I keep getting this error:
clang: error: no such file or directory: '/Users/Andrew/App/Version 1.1/XCode/UIImage+Alpha.m'
clang: error: no input files
I can't continue working on my app because of it. Any ideas?
The problem might be because your project > target > Build Phases > Compile Sources is trying to compile a file that doesn't exist. It might be in there twice, like the below screen shot. My project contains UIImage+FFXtras, I can even remove it and re-add it and this won't resolve the problem!
I'm not sure how the project gets into this state - but I know it's not obvious what is going wrong. Highlight the red problem one and remove it.
So have a look in compile sources phase for the file clang is complaining about.
Got the similar troubles.
It seems XCode does not generate correct relative filepath when your project refer to an already existing source tree (relative path does not contain the .xcodeproj in the path of the file to be compiled).
There is a simple fix however: in the project explorer select the file or files files then look at the options in the file inspector. One of them is labeled "Location"; set it to absolut path and try again. This fixed the issue for me :)
Additional to all answers:
delete derived data
reboot
delete derived data
clean
build
Success!
Only this sequence works for me in my case.
I use quite a few cocoa pods and have just had this happen to me. A quick "pods update" sorted things out for me. -phil
If you are using vs code and facing this issue which says
clang: error: no such file or directory: 'filename'
clang: error: no input files
Error while running files:
I solved this issue by removing the space or replacing the space with underscore(_) in the filename .extension
In case everything fails (i.e. first try bames53 suggestion)
Ok, this might be dangerous so make a copy of your whole project first:
close Xcode
locate the project file in the Finder
right click, choose "show package contents"
open project.pbxproj in a text editor of your choice, but not Xcode
search for your file
at the beginning of the line that shows up, you'll see some id like 640450991409CF5C00B3B580. Search for this and delete any line you find.
pay attention, not to break the syntax (balance parenthesis and brackets, pay attention for commas)
when you are done, save the file and try to open the project in Xcode. Add the missing file via the Add file… dialog of Xcode. It is still in the folder of your project — if you added it successfully in the first place — you just got rid of all project references.
dont be surprised, if it doesnt work instantly — you have a copy. copy it again, new try.
And remember: make a copy of your whole project first — for every try. or copying the project.pbxproj might be enough.
Add this line in your pod-file and run pod install:
use_frameworks!
I had this error in monodevelop. I just went to edit>preferences
and changed the default location of the program files. It was set to the monodevelop default they give you when you open a file and not the folder i changed it too.
Likely, you need to adjust the settings of xcode, where you stored your files.
I was seeing this while setting up a React Native project. Solved it using:
sudo xcode-select --switch /Applications/Xcode.app
Source
Comment Quoted from another site was the issue is resolved for me
hmm that's strange. Try this - click on the name of your project on the list of files/folders on the left in Xcode (at the very top of the list). Look at the "Targets" section on the left-hand side of the window to the right. Likely, there's two listed with the second being a "test" item. Right-click on that item and select "delete". Then try to run the project again. See screenshot below for a visual cue.

Resources