33

after i installed DTCoreText (https://github.com/Cocoanetics/DTCoreText) with Cocoapods i always get an error when i try to run the simulator or device!

ld: warning: directory not found for option '-L/Users/example/Desktop/ios/Pods/build/Release-iphoneos'
ld: warning: directory not found for option '-L/Users/example/Desktop/ios/Pods/build/Debug-iphoneos'
ld: library not found for -lPods-example
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

in my "Link Binary With Libraries" the "libPods" Part is red:

enter image description here

Here are my build Settings:

The Settings of my Project:

enter image description here

The Settings of my Pods:

enter image description here

EDIT:

I´m not exactly sure what was the Problem, but I solved it when i deleted all the DTCoreText and Cocoapods stuff and reeinstalled everything again!

Davis
  • 1,253
  • 4
  • 17
  • 38

13 Answers13

50

Suggest trying the following, that worked for me:

a) Search from 'Library' from the Target Settings view and double-click to inspect the value of Library Search Paths

b) There are two values listed $(inherited) and $(PROJECT_DIR)/Pods/build/Debug-iphoneos. Delete the latter.

c) Do a full clean, build & run

d) Run pod install again. Notice that the entry is not restored.

gemmakbarlow
  • 832
  • 12
  • 23
  • Your answer worked perfect! Why does this work, and where does the $(PROJECT_DIR)/Pods/build/Debug-iphoneos come from in the first place? – preynolds Jun 24 '15 at 09:02
  • 1
    My suspicion is that when you do `pod install` the install script expects a certain state (and can't handle things very effectively if that state is not present). I'm not sure where the `$(PROJECT_DIR)/Pods/build/Debug-iphoneos` came from originally, but deleting it and running a clean install seems to restore the expected state and allow the setup to complete appropriately. (Please note this is all speculative). – gemmakbarlow Jun 24 '15 at 12:51
  • Seems logical. I think this is the second time this error has happened to me, so I wanted to make sure there wasn't something fundamental I was misunderstanding. Many thanks for the insight! – preynolds Jun 24 '15 at 17:40
  • I think this should be reported back to Cocoapods guys. It's certainly bug and It should be easy to track down since this strange path "build/Debug-iphoneos" – Paweł Brewczynski Dec 15 '15 at 04:37
  • Great point Paul - I had assumed it was a known issue, but because the +1 keep coming for this question it might be worth mentioning to the guys and gals of Cocoapods. I'll open something now on their Github. – gemmakbarlow Dec 17 '15 at 01:14
37

Also this may help:

  1. In your main project (not Pods) select the main target
  2. Go to the Build Phases tab
  3. Go to Link Binary with Libraries
  4. Remove the library that is causing the problem (it would probably be in red color)
kudinovdenis
  • 625
  • 6
  • 12
29

Make sure you are opening the .xcworkspace file, not the .xcodeproj

Hsm
  • 1,510
  • 17
  • 16
27

In my linked binaries I had both libPods.a and libPods-MyProj.a. I had previously updated my Podfile to have TWO separate targets (to get it compile tests in Swift with bridging), which meant I had to manually delete the old libPods.a dependency.

Stunner
  • 12,025
  • 12
  • 86
  • 145
bobics
  • 2,301
  • 2
  • 23
  • 25
  • how do you do this thing? I did remove everything of type libPods-* from LInked Binary Libraries, but still getting the same issue. I've started a new thread here: http://stackoverflow.com/questions/31921701/ios-duplicate-symbols-for-architecture-armv7 – meteors Aug 10 '15 at 15:57
  • YES! This was my problem as well; I was writing an app with an App Extension, which wasn't allowed to use some of the code in a few of the pods I was using, so I split it into two targets in the Podfile. Didn't realize that while it added linking to my two new targets, BOTH targets in the project still were trying to link the original unified Pods library. Thank you so much for this answer! – DanM Oct 03 '15 at 03:22
  • I'd like to bump this. I started off without defining the pods per target, and then had to due to test, so had 2 targets, and one which was no longer being used, so delete the libPods.a to solve this issue – Alex Trott Feb 16 '16 at 13:30
  • This is a very common issue, and the proper solution. Might happen as when your project has multiple targets, but only one has a pod dependency. Also may happen when the pod file is updated. – alcamla Jan 13 '17 at 17:35
8

I've found that $(inherited) was missing from my Other Linker Flags build setting. Applying this option fixed a missing library issue I was seeing.

John Dunne
  • 387
  • 1
  • 6
  • 12
  • Can you provide more details please? Where should I add this? – Nuno Gonçalves Mar 16 '15 at 10:58
  • 1
    @NunoGonçalves In Xcode, click on your Project File, you'll see the Project Targets listed to the right. Click on the **Project Target**, then under the Build Settings, search for the settings **Other Linker Flags** and you should see it already listed there. Check this link [link](http://docs.millennialmedia.com/iOS-SDK/iOSAddingLinkerFlag.html) – John Dunne Mar 16 '15 at 13:24
5

I found that selecting "Find implicit Dependencies" (under product / edit scheme) will resolve this issue instead of having to add pods as a target.

StackRunner
  • 1,463
  • 2
  • 16
  • 22
4

Look for "Library Search Path" in you target's Build Settings page. change the folder name of Debug from Debug-iphoneos to Debug-iphonesimulator

Kent Ke
  • 1,239
  • 1
  • 8
  • 6
3

Make sure the missing pods library gets actually built. To do so, open the Build Scheme

Product > Scheme > Edit Scheme... > Build

add the Pods target and put it before the target that complained about the library missing (in my case this were the UI tests – I just struggled with this for hours...)

Thomas Köhn
  • 123
  • 7
2

There are so many reason caused this problem.

We need to check:

  • Build setting $(inherited)
  • Detect all implicit dependencies
  • .......

Troubleshooting: http://guides.cocoapods.org/using/troubleshooting.html

Tony
  • 4,311
  • 26
  • 49
2

For me the error was: that the Pods target did not contain the required architecture slice for i386. So i clicked on the Pods project --> Pods-ProjectName target, and in Build Settings, turned Build Active Architecture Only to NO for both Debug and Release. This makes sure both the Simulator and Device slices are built. The simulator uses the i386 architecture, and the actual devices use x86-64. So you have to make sure all dependent targets for all dependent projects are building both, if you want to run on both Simulator and side loading to devices also.

FranticRock
  • 3,233
  • 1
  • 31
  • 56
0

When you use App extension, navigate to the extension target, and filter to Library Search Path, delete the path the compiler warning to you.

tounaobun
  • 14,570
  • 9
  • 53
  • 75
0

Removing armv7 from VALID_ARCHS within Build Settings resolved this issue for me (Xcode 10.3). I was able to submit after having only armv7s, arm64, and arm64e in VALID_ARCHS.

Stunner
  • 12,025
  • 12
  • 86
  • 145
0

First I ran

sudo rm -r /Library/Developer/CommandLineTools

to remove the command line tools directory. Then I installed command line tools again with

xcode-select --install

This solved the issue for me.

rpontual
  • 85
  • 5