library not found for -lPods 的解决办法

简介: 在老项目工程中使用cocoapods,可能会报这个错误:library not found for -lPods .导致这个错误可能有两个原因,这两个原因在编译过程中都是有蛛丝马迹可循的。

在老项目工程中使用cocoapods,可能会报这个错误:library not found for -lPods .

导致这个错误可能有两个原因,这两个原因在编译过程中都是有蛛丝马迹可循的。

原因1:

在 pod install时,就会有告警信息提示:

xxx target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation

xxx target overrides the `HEADER_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation

xxx target overrides the `OTHER_CFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation

This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

很明确的告知:通过添加 `$(inherited)` flag 可以解决该问题。

根据调试确认,OTHER_LDFLAGS 指的是 other linker flags; OTHER_CFLAGS 指的是 other c flags;HEADER_SEARCH_PATHS 指的是 header search paths.

将这三处修改完毕后再次运行pod install,可以发现告警信息已经不再出现了。


原因2:

在编译时有如下的警告和错误:

1.警告: Target 'Pods' of project 'Pods' was rejected as an implicit dependency for 'libPods.a' because its architectures 'arm64' didn't contain all required architectures 'armv7 arm64'

2.错误: ld: library not found for -lpop
clang: error: linker command failed with exit code 1 (use -v to see invocation)

这里不留神可能警告会被忽略(毕竟在一个老项目中有一些警告很正常),但这个警告才是问题的关键。

pod里面的build选项里build active architecture only 在 debug情形下默认是 YES, 这里如果和你项目的该设置不匹配(笔者用来调试的项目这里设置就是NO)的话那么就会报告该错误。

在pods里面的target中挨个修改其配置和原有的工程一致,然后clean编译,项目即可正常运行。

目录
相关文章
|
7月前
|
测试技术 iOS开发 Perl
废弃第三方库导致的library not found for -lXXXXX(linker command failed ) 完美解决方法
废弃第三方库导致的library not found for -lXXXXX(linker command failed ) 完美解决方法
107 0
|
7月前
|
iOS开发 Perl
Xcode 10.2.1 Error:library not found for -lstdc++.6.0.9
Xcode 10.2.1 Error:library not found for -lstdc++.6.0.9
74 0
|
7月前
|
Java 定位技术 Android开发
安装apk显示 requires unavailable shared library com.xxx
安装apk显示 requires unavailable shared library com.xxx
89 0
codeblocks中出现#error This file requires compiler and library support for the错误时的解决方案
codeblocks中出现#error This file requires compiler and library support for the错误时的解决方案
721 0
codeblocks中出现#error This file requires compiler and library support for the错误时的解决方案
编译x264出现错误:No working C compiler found.
编译x264出现错误:No working C compiler found.
341 0
解决办法:configure: error: C compiler cannot create executables错误
解决办法:configure: error: C compiler cannot create executables错误
626 0
错误解决:当前目录下有so,提示 error while loading shared libraries
错误解决:当前目录下有so,提示 error while loading shared libraries
94 0
|
移动开发 iOS开发
IOS开发错误library not found for -lXXX
IOS开发错误library not found for -lXXX
1126 0
IOS开发错误library not found for -lXXX
Xcode12.x报错: ld: library not found for -lstdc++.6.0.9
错误信息: ld: library not found for -lstdc++.6.0.9 报错原因:Xcode10移除了动态库libstdc
281 0
关于问题ld:library not found for -lXXX的错误
关于问题ld:library not found for -lXXX的错误
784 0