Question

I get these errors when I try to build an iOS application.

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

Ld /Users/Markus/Library/Developer/Xcode/DerivedData/Totalbox-clpeqwpfvwuhpleeejnzlavncnvj/Build/Products/Debug-iphonesimulator/Totalbox.app/Totalbox normal x86_64
cd /Users/Markus/Development/xcode/totalbox-ios
export IPHONEOS_DEPLOYMENT_TARGET=7.1
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot 
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -L/Users/Markus/Library/Developer/Xcode/DerivedData/Totalbox-clpeqwpfvwuhpleeejnzlavncnvj/Build/Products/Debug-iphonesimulator -F/Users/Markus/Library/Developer/Xcode/DerivedData/Totalbox-clpeqwpfvwuhpleeejnzlavncnvj/Build/Products/Debug-iphonesimulator -filelist /Users/Markus/Library/Developer/Xcode/DerivedData/Totalbox-clpeqwpfvwuhpleeejnzlavncnvj/Build/Intermediates/Totalbox.build/Debug-iphonesimulator/Totalbox.build/Objects-normal/x86_64/Totalbox.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -ObjC -framework CoreGraphics -framework Foundation -framework MobileCoreServices -framework QuartzCore -framework Security -framework SystemConfiguration -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.1 -framework CoreGraphics -framework UIKit -framework Foundation -lPods -Xlinker -dependency_info -Xlinker /Users/Markus/Library/Developer/Xcode/DerivedData/Totalbox-clpeqwpfvwuhpleeejnzlavncnvj/Build/Intermediates/Totalbox.build/Debug-iphonesimulator/Totalbox.build/Objects-normal/x86_64/Totalbox_dependency_info.dat -o /Users/Markus/Library/Developer/Xcode/DerivedData/Totalbox-clpeqwpfvwuhpleeejnzlavncnvj/Build/Products/Debug-iphonesimulator/Totalbox.app/Totalbox

PODS ROOT in the build settings:

${SRCROOT}/Pods

I didn't create this Xcode project - just pulled it from git to check it out.

Was it helpful?

Solution

If the project uses CocoaPods be aware to always open the .xcworkspace file instead of the .xcodeproj file.

OTHER TIPS

Had this problem as well. Something was wrong with my CocoaPods installation. No pods other than KIF were installing properly. I followed the comments on this thread to be of help.

Basically, I needed to ensure that Build Active Architectures Only settings for both my project and the Pods project were equal.

After hours of research this solution worked for me:

(disclaimer: results may vary due to circumstances)

the Library not found -lPods-(someCocoapod) error was due to multiple entries in the :

Settings(Target) > Build Settings > Linking > 'Other Linker Flags'

A lot of other posts had me look there and I would see changes to the error when I messed around with the entries, but I kept getting some variation on the same error.

Too many hours lost ...

My Fix:

remove the -lPods-(someCocoaPod) lines in the 'Other Linker Flags' list BUT only if $(inherited) is at the top. At first I was unsure, but the reassuring sign was that I still saw references to my cocoapods when I left the edit mode(inherited). I tested in debug and release, both of which were giving me errors, and the problem was immediately resolved.

My problem had fixed by the following config:

Build Active Architecture Only: YES

It seems project has been using cocoapods. and that files are missing from your project.

You cant just download it from git. You need to install it from cocoapods.

for more help, you may follow Introduction to CocoaPods Tutorial

If the project uses CocoaPods be aware to always open the .xcworkspace file instead of the .xcodeproj file

If you have multiple targets in your project, Cocoapods may have only integrated itself well with just one of them.

I had to manually link to libPods.a in "Link Binary With Libraries" for each additional target I had.

libPods.a in my list of frameworks

This problem-related to lPods can be fixed by following the steps below

  • Select your Project Target.
  • Go to "Build Phases" in "Link Binary With Libraries".
  • Now remove ".a" file of that library which is creating the problem.
  • Clean and Build.

This will work.

If anyone came here to resolve an error with react-native-fbsdk after installing it using Cocoapods, keep in mind that you have to remove all the other .a files in your Projects build phases and only keep the .a from cocoapods called libPods-WhateverAppName.a.

Only that remains here

This is usually caused from running rnpm link and the way rnpm works.

After I removed the facebook core .a file from my build phases my project was up and running once again.

None of the above answers fixed it for me.

What I had done instead was run pod install with a pod command outside of the target section. So for example:

#WRONG
pod 'SOMEPOD'

target "My Target" do
    pod 'OTHERPODS'
end

I quickly fixed it and returned the errant pod back into the target section where it belonged and ran pod install again:

# CORRECT
target "My Target" do
    pod 'SOMEPOD'
    pod 'OTHERPODS'
end

But what happened in the meantime was that the lib -libPods.a got added to my linked libraries, which doesn't exist anymore and shouldn't since there is already the -libPods-My Target.a in there.

So the solution was to go into my Target's General settings and go to Linked Frameworks and Libraries and just delete -libPods.a from the list.

My steps:

  1. Delete the pods folder and the 'Pods' file.
  2. Type "pod install" into Terminal.
  3. Type "pod update" into Terminal.

In addition to making sure "Build Active Architectures" was set to YES as mentioned in previous answers, this was what had done it for me.

It took sometime to figure it out... I am trying to build swift framework which in turn depends on one cocoa pod library for which I was getting this error while creating build in release mode , in debug mode it was working fine!

I verified if all targets have same deployment target and found that there was mismatch pods target was having different iOS deployment target than my framework so I kept same iOS deployment target everywhere (swift framework, pod targets) and it worked like charm!

enter image description here

Had a same issue after upgrading Deployment target from 7.0 to 8.0 and enabling use_frameworks!

cocoapods did not delete previously generated PodName.a files from the Frameworks section of my project.

So I had to delete those manually, because they caused the linker error

If the project uses CocoaPods be aware to always open the .xcworkspace file instead of the .xcodeproj file. if you are using .xcworkspace , Please reinstall the pod file by removing the pods and again insert the pods and install it !!! this worked for me

Delete all the corresponding files/folders of imported cocoapods source except podfile.

install cocoapod again.This should clear any redundant pull from the original source.

This was my issue while trying to integrate Firebase to my Xcode project using cocoapods

library not found for -lGoogleToolboxForMac
linker command failed with exit code 1 (use -v to see invocation)

After hours of searching and trying out various fixes listed in the stackoverflow, my issue was finally fixed doing following steps

  1. Go to Build Settings, search for Other Linker Flags, remove all values expect $(inherited) Image

Do this for all targets.

  1. Delete the pods folder. (ios/Pods)
  2. Do pod update

Voila! All linker errors will be gone.

When you clone project from somewhere which uses Cocoapods you need to install them to your project.

Here step-by-step what you need to do:

  • 1) clone source code to local machine;
  • 2) close the xcode project (if open);
  • 3) install cocoapods application on your mac by running this command in terminal: "gem install cocoapods", add "sudo " in the beginning if did not work;
  • 4) go to the root of your xcode project by using "cd" command in terminal;
  • 5) you should have Podfile in this folder; if you want to double check it use: "cat Podfile" command, it will display the content of this file with Libraries that will have to be installed to your project;
  • 6) then use "pod install" command to download and install the Libraries to your project; the Podfile.lock will be created and {Your project name}.xcworkspace file;
  • 7) from now on you have to use {Your project name}.xcworkspace to open it in xcode;

Good luck!

I had the same problem

pod install and pod update on command line resolve my problem

For me, following had worked.

  1. Go to "Project Target -> Build Settings -> Preprocessing -> Preprocessor Macros". Set "COCOAPODS=1" in all Debug, Integration, Release under "Preprocessor Macros"
  2. Add the following in "Other Linker Flags" under "Project Target"
    1. $inherited
    2. -ObjC
    3. -lc++
    4. -all_load

Clean and run the project. If still error receives the same then try by setting "Project Target -> Build Settings -> Build Active Architectures Only", Set "Debug" to "YES" and set "Integration and Release" to "No". Then Repeat the same setting of "Build Active Architectures Only" for all "Pods Targets"

Clean and run the project. If you receive the following error

 No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386).

Then try Mr. Mike answer in this link

Xcode 5.1 - No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386)

Hope it helps!

In a project with multiple targets I had the same issue after changing the Scheme and App name and tried to update pods. The issue was caused because of multiple entries in Build Phases -> Link Binary with Libraries where both the previous .a library and the current one was listed, while the previous one was not existing anymore. Removing the library from there cleared the problem.

After spending half a day on this I discovered my problem. I had upped the deployment target from 10 to 12.1 due to some dependencies. I updated the project deployment target and all my pods.

I just discovered that there is a deployment target at target level as wel. After upping this to 12.1 my project builds again.

Deplyment target for "project"

Podfile:

Deployment target for "Target":

My way

  1. create new project and install pod it will can run without error.

  2. Copy text in "Other Linker Flags" in new project to old project. Make old project to same new project.

  3. Check "Header Search Paths" too.

For me this is worked. I have changed my app name from someApp to otherApp. And I am using cocoa pods for multiple third party services integration. So Because of that 2 libPod files added(As I have changed name and target of app). Finally I had to remove one libPod. And it worked.

target-> Build phases-> Link Binary With Libraries

I got the same error.

The issue: I created a separate Workspace and added my existing project into it. I got the error when I worked on that Workspace.

The fix: Later I found that Workspace gets created automatically inside the existing project when dependencies are added. And have to work on that workspace.

The below solution worked for me for the core-plot 2.3 version. Do the below changes under other linker flags section.

1.Add $(inherited) and drag this item to top position 2.Remove "Pods-" prefix from -l"Pods-fmemopen”, l"Pods-NSAttributedStringMarkdownParser” and -l"Pods-MagicalRecord”.

if still issue persists, Finally see if PODS_ROOT is set or not. You can check it under user defined section.

Check the deployment target in General and go to pod file and see

platform :ios, '11.0'

this 11.0 should be same in deployment target

This error

Library not found for -lRNDateTimePicker

Was solve by downgrading "@react-native-community/datetimepicker" to "5.1.0", from "^6.3.2"

Hope it helps

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top