ios Xcode - ld:找不到 -lPods 的库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23539147/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 00:06:13  来源:igfitidea点击:

Xcode - ld: library not found for -lPods

iosobjective-cxcodeclangcocoapods

提问by mrks

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

我在尝试构建 iOS 应用程序时遇到这些错误。

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:

构建设置中的 PODS ROOT:

${SRCROOT}/Pods

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

我没有创建这个 Xcode 项目——只是从 git 中提取它来检查它。

回答by H6.

If the project uses CocoaPods be aware to always open the .xcworkspacefile instead of the .xcodeprojfile.

如果项目使用 CocoaPods,请注意始终打开.xcworkspace文件而不是.xcodeproj文件。

回答by Stunner

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 threadto be of help.

也有这个问题。我的 CocoaPods 安装出了点问题。除了 KIF 之外,没有其他 Pod 安装正确。我按照此线程上的评论来提供帮助。

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

基本上,我需要确保Build Active Architectures Only我的项目和 Pods 项目的设置相同。

回答by damote

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 :

Library not found -lPods-(someCocoapod)错误是由于多个条目:

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

删除“其他链接器标志”列表中的 -lPods-(someCocoaPod) 行,仅当 $(inherited) 位于顶部时。起初我不确定,但令人放心的迹象是,当我离开编辑模式(继承)时,我仍然看到对我的 cocoapods 的引用。我在调试和发布中进行了测试,两者都给了我错误,问题立即得到解决。

回答by Rahul Patel

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

似乎项目一直在使用cocoapods。并且您的项目中缺少该文件。

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

你不能只从 git 下载它。您需要从 cocoapods 安装它。

for more help, you may follow Introduction to CocoaPods Tutorial

如需更多帮助,您可以参考 CocoaPods 介绍教程

If the project uses CocoaPodsbe aware to always open the .xcworkspacefile instead of the .xcodeprojfile

如果项目使用CocoaPods注意总是打开.xcworkspace文件而不是.xcodeproj文件

回答by Rizwan Sattar

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

如果您的项目中有多个目标,则 Cocoapods 可能只与其中之一很好地集成在一起。

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

对于我拥有的libPods.a每个附加目标,我必须手动链接到“链接二进制库”。

libPods.a in my list of frameworks

libPods.a 在我的框架列表中

回答by Durul Dalkanat

My problem had fixed by the following config:

我的问题已通过以下配置解决:

Build Active Architecture Only: YES

回答by SudoPlz

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

如果有人来这里解决的错误react-native-fbsdk使用安装后Cocoapods,请记住,你必须删除所有其他.a文件在项目建设阶段,只有不断从的CocoaPods称为.A libPods-WhateverAppName.a

Only that remains here

只剩下这里了

This is usually caused from running rnpm linkand the way rnpm works.

这通常是由运行rnpm link和 rnpm 的工作方式引起的。

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

在我从构建阶段删除 facebook 核心 .a 文件后,我的项目再次启动并运行。

回答by Abuzar Amin

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

可以按照以下步骤修复与 lPods 相关的此问题

  • 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.
  • 选择您的项目目标。
  • "Build Phases""Link Binary With Libraries"
  • 现在删除".a"产生问题的那个库的文件。
  • 清洁和建造。

This will work.

这将起作用。

回答by gravy

None of the above answers fixed it for me.

以上答案都没有为我解决。

What I had done instead was run pod installwith a podcommand outside of the targetsection. So for example:

我所做的是pod install使用podtarget部分之外的命令运行。例如:

#WRONG
pod 'SOMEPOD'

target "My Target" do
    pod 'OTHERPODS'
end

I quickly fixed it and returned the errant pod back into the targetsection where it belonged and ran pod installagain:

我迅速修复了它并将错误的 pod 放回target它所属的部分并pod install再次运行:

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

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

但与此同时发生的事情是,lib-libPods.a被添加到我的链接库中,它不再存在,也不应该存在,因为那里已经-libPods-My Target.a有了。

So the solution was to go into my Target's General settingsand go to Linked Frameworks and Librariesand just delete -libPods.afrom the list.

所以解决方案是进入我的目标的常规设置并转到链接的框架和库,然后-libPods.a从列表中删除。

回答by David Liu

My steps:

我的步骤:

  1. Delete the pods folder and the 'Pods' file.
  2. Type "pod install" into Terminal.
  3. Type "pod update" into Terminal.
  1. 删除 pods 文件夹和“Pods”文件。
  2. 在终端中输入“pod install”。
  3. 在终端中输入“pod update”。

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.

除了像之前的答案中提到的那样确保“构建活动架构”设置为“是”之外,这就是为我所做的。