library not found for -lPods

2019-01-02 22:08发布

I got an error when archiving a project. This is my environment.

  • Mac OS Lion
  • Xcode 4.3.1
  • iOS SDK 5.1

The project deployment target is:

IPHONEOS_DEPLOYMENT_TARGET 3.2

The error shows:

ld: library not found for -lPods
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I guess Pods is CocoaPods that I used to manage XCode project dependencies. https://github.com/CocoaPods/CocoaPods

This is my Podfile

platform :ios  
dependency 'libPusher', '1.1'

I am not sure what the error means?

30条回答
家丑人穷心不美
2楼-- · 2019-01-02 22:30

Not a solution worked for me, this is really unbearable, there's a file libpods.a(which was red coloured) I removed it and everything working fine! Cheers to me ;)

查看更多
再贱就再见
3楼-- · 2019-01-02 22:30

CocoaPods' wiki on GitHub has the answer right in their FAQ:

  • Go to Product > Edit Scheme
  • Click on Build
  • Add the Pods static library, and make sure it's at the top of the list
  • Clean and build again
  • If that doesn't work, verify that the source for the spec you are trying to include has been pulled from github. Do this by looking in <Project Dir>/Pods/<Name of spec you are trying to include>. If it is empty (it should not be), verify that the ~/.cocoapods/master/<spec>/<spec>.podspec has the correct github url in it.
  • If still doesn't work, check your XCode build locations settings. Go to Preferences -> Locations -> Derived Data -> Advanced and set build location to "Relative to Workspace".

Screen shot

查看更多
三岁会撩人
4楼-- · 2019-01-02 22:34

In this issue,If you have already installed & update pod in your system then your Xcode not being able to find the Pods library.To resolve this issue, please check for following causes that may take place:

  1. You are using the workspace.
  2. The Pods library builds.
  3. The Pods library is referenced in the products group of your project.
  4. Your target includes the Pods library in the link with frameworks build phase.
查看更多
做个烂人
5楼-- · 2019-01-02 22:35

try

link_with 'YouTarget1', 'YouTarget2' ...

My project worked, the targets suddenly stopped compiling. Then added "link_with" and returned to normal.

Apparently, now it just connects to the first target, is what the link says:

http://guides.cocoapods.org/syntax/podfile.html#link_with

查看更多
老娘就宠你
6楼-- · 2019-01-02 22:36

Using ONLY_ACTIVE_ARCH=NO in all pods solved the problem for me. To make this persistent, I added a post_install hook to my Podfile:

post_install do |installer_representation|
  installer_representation.project.targets.each do |target|
      target.build_configurations.each do |config|
            config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
      end
  end
end

pod install and you're done.

查看更多
来,给爷笑一个
7楼-- · 2019-01-02 22:36

I was renaming the project to "NBSelector" from "Partners".

I had "Library not found for libPods-Partners" error after renaming the project. Xcode was trying to link to old Partners.a file. Just remove it if you have podInstalled after renaming.

enter image description here

查看更多
登录 后发表回答