简体   繁体   中英

Error: ld: library not found for -lPods with CocoaPods

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:

在此处输入图片说明

Here are my build Settings:

The Settings of my Project:

在此处输入图片说明

The Settings of my Pods:

在此处输入图片说明

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!

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.

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)

确保您打开的是 .xcworkspace 文件,而不是 .xcodeproj

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.

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.

我发现选择“查找隐式依赖项”(在产品/编辑方案下)将解决此问题,而不必添加 pod 作为目标。

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

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

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

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.

使用App扩展时,导航到扩展目标,过滤到库搜索路径,删除编译警告给你的路径。

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 .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM