Cocoapods: Library not found for -lPods

Created on 9 Mar 2012  Â·  56Comments  Â·  Source: CocoaPods/CocoaPods

Hey guys,

I'm getting the error "Library not found for -lPods".

This is after following the instructions in the README at https://github.com/CocoaPods/CocoaPods/blob/master/README.md

Additionally, I found https://github.com/CocoaPods/CocoaPods/wiki/Creating-a-project-that-uses-CocoaPods and followed step 4 in the FAQ (which specifically addresses this issue), but I still get the same error.

Versions:
Xcode: 4.2
OS X: 10.6.8

defect

Most helpful comment

I had this issue aswell, tried everything what already has been told here. Still had the issue. My problem was that I had an old libPods.a in "Link binary with libraries" , removed it and did a pod install again.

Now working.

All 56 comments

interestingly, I do see a libPods.a file, so I'm not sure why Xcode doesn't see it.

cell@Immortal$ pwd
/Users/cell/Desktop/PodsTest

cell@Immortal$ find . | grep Pods.a
./Pods/build/Debug-iphonesimulator/libPods.a

Hmm, it should not build it in ./Pods/build, but in a shared build directory of the workspace. It should be either in ./DerivedData or the default setting of ~/Library/Developer/Xcode/DerivedData/APP.

hmm, this may be due to a setting we use here at work.

in Xcode -> Preferences, under the Locations tab, there is a Derived Data setting. Mine is set to "Default". Then, under the Advanced tab, it is set to "Locations specified by targets".

So perhaps I can change the Pods target to specify a different location for the derived data, to make it compatible with the existing implementation?

Interesting, there is also File -> Workspace Settings, which also has a derived data location setting. I'll try futzing with that.

findings:

File -> Workspace Settings -> Derived Data Location = Default:

cell@Immortal$ pwd
/Users/cell/Desktop/PodsTest
cell@Immortal$ find . | grep 'libPods.a'
./Pods/build/Debug-iphonesimulator/libPods.a

File -> Workspace Settings -> Derived Data Location = Workspace-relative (set to "DerivedData"):

cell@Immortal$ find . | grep 'libPods.a'
./Pods/build/Debug-iphonesimulator/libPods.a

File -> Workspace Settings -> Derived Data Location = Custom (set to "/Users/cell/Library/Developer/Xcode/DerivedData"):

cell@Immortal$ find . | grep 'libPods.a'
./Pods/build/Debug-iphonesimulator/libPods.a

interesting... it appears to be completely ignoring that setting. I even ran a clean, and a 'find' in between each setting to verify the previous .a file had disappeared.

all of the above was with Xcode -> Preferences -> Locations -> Locations -> Derived Data = Default, Advanced -> Build Location = Locations specified by targets.

Here I'll try the same, but with Xcode -> Preferences -> Locations -> Locations -> Derived Data = Default, Advanced -> Build Location = Derived Data Locations (recommended), Unique Subfolder.

Ah, it succeeds right away, and the 'find' command doesn't turn up anything.

Argh, this means I'm going to have to toggle that setting every time I switch from work to CocoaPods experimentation...

Does the project normally not build with this setting? Maybe that can be solved?

For now I will close this. If, however, you find that it is essential that CocoaPods can handle this and you have found a workaround then please re-open it.

I'm having the same problem... I've also followed the steps on the Readme and on the wiki that @cellularmitosis mentions on his first commit. The thing is that I can perfectly build and run on the simulator, the problem comes when building for a device.

Am I missing something?

OK, I think the problem comes from a xcode configuration error. When compiling for simulator Pods project get compiled ok, but when compiling for device, it doesn't. That's why it can't find libPods.a, because it doesn't exist.

Problem found. My app's target is configured for both architectures armv6 and armv7, but Pods project is configured only for armv7.

Hope this helps somebody in the same situation.

In that case you should specify the platform in your Podfile like so:

platform :ios, :deployment_target => '4.0'

(Or whichever your target is.)

HTH

On Apr 17, 2012, at 1:03 PM, Victor P. wrote:

Problem found. My app's target is configured for both architectures armv6 and armv7, but Pods project is configured only for armv7.

Hope this helps somebody in the same situation.


Reply to this email directly or view it on GitHub:
https://github.com/CocoaPods/CocoaPods/issues/155#issuecomment-5172551

Oh, I didn't know that :)

El 17/04/2012, a las 13:39, "Eloy Durán"
[email protected]
escribió:

In that case you should specify the platform in your Podfile like so:

platform :ios, :deployment_target => '4.0'

(Or whichever your target is.)

HTH

On Apr 17, 2012, at 1:03 PM, Victor P. wrote:

Problem found. My app's target is configured for both architectures armv6 and armv7, but Pods project is configured only for armv7.

Hope this helps somebody in the same situation.


Reply to this email directly or view it on GitHub:
https://github.com/CocoaPods/CocoaPods/issues/155#issuecomment-5172551


Reply to this email directly or view it on GitHub:
https://github.com/CocoaPods/CocoaPods/issues/155#issuecomment-5173015

In my environment the issue was that the Pods project did not have a target called ADHOC (as per the main project). I duplicated the Pods release target, called it ADHOC, changed the OS Deployment Target to my requirement (5.0) and then everything worked.

@nicktmro This will be automated in the next release. As a matter of fact, it would be great, if you feel adventurous, if you could give the current HEAD version a spin to see that it actually works in your situation.

PS: I’ve just added a wiki page with instructions on how to use the HEAD version.

/Same problem here, I tried changing different configurations to no avail. What is the final solution that worked for you guys?

Hi Tony,

I just upgraded to 0.6.0.rc2 on friday, and confirmed that project
configurations (e.g. AdHoc) now get created in the Pods project as well.

-jason

On Sat, Jun 23, 2012 at 11:23 PM, tonyxiao <
[email protected]

wrote:

/Same problem here, I tried changing different configurations to no avail.
What is the final solution that worked for you guys?


Reply to this email directly or view it on GitHub:
https://github.com/CocoaPods/CocoaPods/issues/155#issuecomment-6530416

I'm still having this problem. My issue is that the libPods.a file is never being generated, in either the DerivedData folder, or locally in the project. Where is "libPods.a" supposed to get created?

I had the same issue, but it was fixed by performing a pod update and reloading the workspace.

Cool, thanks.

  • Alex

On Monday, November 5, 2012 at 6:54 PM, Matthew Purland wrote:

I had the same issue, but it was fixed by performing a pod update and reloading the workspace.

—
Reply to this email directly or view it on GitHub (https://github.com/CocoaPods/CocoaPods/issues/155#issuecomment-10096530).

So I was just having this issue.

My podfile was set to - platform :ios, :deployment_target => "6.0"
changed deployment_target to 5.0
pod install
Fixed

Bizarre. I should note I have two targets in my podfile just in case it's that.

After setting up cocoapods, xcode is looking for libPods.a for the Pods Target at the path:

/Users/iellis/Library/Developer/Xcode/DerivedData/theHunt-drrdmhifgdiqepgmbdccedvmdkvv/Build/Products/Debug/libPods.a

and for the App Target, it's looking here:

/Users/iellis/Library/Developer/Xcode/DerivedData/theHunt-drrdmhifgdiqepgmbdccedvmdkvv/Build/Products/Debug-iphoneos/libPods.a

libPods.a is actually being built in ~/Library/Developer/Xcode/DerivedData/theHunt-drrdmhifgdiqepgmbdccedvmdkvv/Build/Products/Debug-iphonesimulator

I'm not getting any warnings or errors and I can use the installed pods, but libPods.a shows up red in the file browser in XCode as if it can't be found. This seems wrong, but I'm not sure what it's affecting or how to clean it up.

Any ideas?

I'm not getting any warnings or errors and I can use the installed pods, but libPods.a shows up red in the file browser in XCode as if it can't be found. This seems wrong, but I'm not sure what it's affecting or how to clean it up.

I would not bother too much about this if you don't have any issue, I think that it is just a minor UI bug of Xcode.

An idea:
Add a 'Run Script' phase to Pods project.
When building libPods.a, it adds $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) to LIBRARY_SEARCH_PATH in Pods.xcconfig

Hi:

I've solved with the following way:

Xcode > Preferences > Locations > Locations > Advanced and a windows will appear, select Unique.

I had selected Legacy.

When you select Unique, click done and close the preferences. Build the project and the error should dissapear.

@AlfonsoUceda I set it legacy always because of some other libraries but it doesn't help this problem.

update pod, and then everything is ok

This is the error I got at the start. The solution seemed to be opening up the xcworkspace rather than the xcodeproj (YMMV)

From the GitHub repo README.md:

Remember to always open the Xcode workspace instead of the project file when you're building.
$ open App.xcworkspace

Closing as not actionable. If somebody encounters a bug related to this issue please repot the conditions to reproduce it.

I had an issue were I could build for the simulator but not for my iPad. I was getting this error "library not found for -lPods". I tried the suggestion made here and none of them worked.

This is what my PodFile looked liked.

platform :ios, '6.0'

target :integration, :exclusive => true do
  link_with "Autoship Integration Test"
  pod 'KIF'
end

target :test, :exclusive => true do
  link_with "Usana AutoshipTests"
  pod 'Kiwi'
end

Thinking that maybe my default target needed to link to something I changed my PodFile to this.

platform :ios, '6.0'

pod 'MBProgressHUD', '~> 0.6'

target :integration, :exclusive => true do
  link_with "Autoship Integration Test"
  pod 'KIF'
end

target :test, :exclusive => true do
  link_with "Usana AutoshipTests"
  pod 'Kiwi'
end

Everything now works and I can remove MBProgressHUD from my PodFile and it still works.

Had the same problem with a newly generated project("Empty Application" template, pod setup/install).

Setting "Preferences -> Locations -> Advanced" to "Custom(Relative to Workspace)" fixed the missing libPods.a.

antstorm solution workedt fine also for me.
Thanks :+1:

+1 For antstorm's fix

Unfortunately, I should use 'Legacy' for scripts at this time. Maybe I should fix scripts...

antstorm's fix worked very well
Thanks

+1 mgchris

So was I having this annoying problem
I updated my cocoapods version and deleted all related files,podfile.lock,pods folder and .xcworkspace
then run pod installed
Problem fixed
Hope it would help

Hi Nathan0518!

I was having the same issue and did the same steps as you: problem not fixed...
What worked for me was setting the value of the key "Build Active Architecture Only" to NO in the Build Settings of the Pods project inside my workspace.

Hope this can help other people too :)

What worked for me was setting the value of the key "Build Active Architecture Only" to NO in the Build Settings of the Pods project inside my workspace.

@cicerocamargo While that works too, it is actually the opposite of what we suggest you do. Which is to set _your_ project to "Build Active Architecture Only" to YES in the ‘Debug’ configuration.

This is the Xcode 5 default, which makes sense, as you need to compile less in development mode.

I am having this same exact problem. I have tried all of your suggestion and still cannot figure it out. Does anyone have any suggestions? Thanks

Having a similar problem also and I have tried the solutions above. I had to do redo 'gem install' on cocoapod because of a merge conflict due to libgit2 also

Same problem here. libPods.a appears in red even when I create a new empty project and add any cocoapod. Should be easily reproducible.

it took me a couple hours to get it right . I didn't have any problems when I was testing on simulator, even the libPods.a is still red. When I loaded it on the real device, I got the error "Library not found for -lPods". I double checked the both targets( my app and pod ) build settings. tried a couple of suggested solutions, didn't work. At the end , I had to remove all the files associated with pod and updated pod , rebuild project, this time the error is gone and file libPods.a color turn it into normal color. I hope this can save some time for you. oh debugging, you got love it : )

I had this problem while these build settings were in place on my Unity project

9gtag6o

Removing them resolved the issue.

I had this issue aswell, tried everything what already has been told here. Still had the issue. My problem was that I had an old libPods.a in "Link binary with libraries" , removed it and did a pod install again.

Now working.

Thanks @PlayDevelop, that fixed it for me as well.

Solution for me was to remove all pod related files (Pods, Podfile.lock), clean project, remove libPods.a from Build Settings, then run pod install again.

I also had this issue as well removed it and pod install again . ok

Same problem on cocoapods 0.35.0, in my case, after pod update the file project.pbxproj have lost all VALID_ARCHS and set ONLY_ACTIVE_ARCH to YES.

@PlayDevelop Thanks, delete the old libPods.a works for me.

@Jeswang @PlayDevelop YES! Remove libPods.a from "Link Binary With Libraries" in "Build Phases" fixed the issue for me which appeared to crop up almost inexplicably.

Burned a few hours on this today, tried #allthethings that were listed here (lots of removing pods and pod installing. even tried a fresh project from scratch but kept hitting the same missing libPods.a issue. The first symptom that led me to this was trying to import Alamofire in a swift file, but xcode could never find that module.

Solution that finally just worked for me was upgrading to the Beta: gem install cocoapods --pre and then pod install, which seems to move away completely from the libPods.a file to an actual Pods.framework. Restarted the workspace, and all is happy again.

For future ref: current Beta at the time of writing is: 0.36.0.beta.2

I had same problem. My problem was about "Build Active Architectrure Only" , I set that option to "NO" to solve the problem. Hope this could help anyone with the same problem.

@PlayDevelop fixed and worked for me, thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

k06a picture k06a  Â·  3Comments

intelliot picture intelliot  Â·  3Comments

luhui picture luhui  Â·  3Comments

spencerkohan picture spencerkohan  Â·  3Comments

pallaviMN picture pallaviMN  Â·  3Comments