Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 687
soleil Avatar asked Dec 09 '13 20:12

soleil


5 Answers

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.

like image 162
kalmiya Avatar answered Oct 17 '22 10:10

kalmiya


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

like image 25
Egil Sandfeld Avatar answered Sep 20 '22 13:09

Egil Sandfeld


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
like image 21
Ketan Avatar answered Oct 17 '22 09:10

Ketan


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

like image 8
Taka Avatar answered Oct 17 '22 10:10

Taka


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)

like image 4
Chandu kumar.Alasyam Avatar answered Oct 17 '22 10:10

Chandu kumar.Alasyam