zoukankan      html  css  js  c++  java
  • 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编译,项目即可正常运行。

  • 相关阅读:
    5
    4
    3
    crontab -e 报错(E518: Unknown option: foldenable)
    解决无法修改日志时间的问题(Local time zone must be set--see zic manual page 2019 )
    ping测试丢包率
    关闭SELinux
    iotop使用方法
    mysql的备份
    修改uid gid 的起始范围
  • 原文地址:https://www.cnblogs.com/fengju/p/6173618.html
Copyright © 2011-2022 走看看