目标...覆盖`Pods / Pods.xcconfig中定义的`OTHER_LDFLAGS`构建设置

时间:2013-08-22 09:22:45

标签: xcode cocoapods

我已将SpatialIite合并到一个Xcode项目中,该项目使用来自Proj.4的头文件,只有一个标头。两者都是Xcode项目并具有静态目标。

我正在尝试从git子模块迁移到Cocoapods。由于静态目标似乎很难与Cocoapods一起使用,我只想以通常的方式构建项目。我为Proj.4制作了podspec。在为SpatialLite编写podfile后,我收到了警告:

[!] The target `SpatialiteIOS [Debug]` overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig'.
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The target `SpatialiteIOS [Debug]` overrides the `HEADER_SEARCH_PATHS` build setting defined in `Pods/Pods.xcconfig'.
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The target `SpatialiteIOS [Debug - Release]` overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig'.
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The target `SpatialiteIOS [Debug - Release]` overrides the `HEADER_SEARCH_PATHS` build setting defined in `Pods/Pods.xcconfig'.
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

我读过this issue,但我对这些警告意味着什么以及我该怎样做才能解决这个问题一无所知。

另外一个问题,当我打开工作区以及单独打开SpatiaLite项目时,两者都是针对Mac OSX 64的,当它被认为是一个iOS项目时。我的podfile确实说“platform:ios”。

12 个答案:

答案 0 :(得分:487)

这绝对适用于大部分时间:

转到目标构建设置 - >其他链接器标志 - >双击。将$(inherited)添加到新行。

如果您对" ...有问题,则会覆盖在..."中定义的GCC_PREPROCESSOR_DEFINITIONS构建设置。那么你必须将$(继承)添加到目标Build Settings - >预处理器宏

答案 1 :(得分:74)

您的构建设置与Cocoapods想要的默认构建设置之间存在冲突。要查看Cocoapods构建设置,请在项目中的Pods / Target Support Files / Pods - $ {PROJECTNAME} /中查看.xcconfig文件。对我来说,这个文件包含:

GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/Commando"
OTHER_LDFLAGS = -ObjC -framework Foundation -framework QuartzCore -framework UIKit
PODS_ROOT = ${SRCROOT}/Pods

如果您对Cocoapods设置感到满意,请转到项目的Build Settings,找到合适的设置并点击Delete键。这将使用Cocoapods的设置。

另一方面,如果您需要使用自定义设置,请将$(继承)添加到该设置。

答案 2 :(得分:25)

我在终端

中看到了pod命令的这3个错误
pod install
  

[!] MY_APP [Debug / Release]目标覆盖了   HEADER_SEARCH_PATHS ...
  [!] MY_APP [Debug / Release]目标   覆盖OTHER_LDFLAGS ...
  [!] MY_APP [Debug / Release]目标   覆盖GCC_PREPROCESSOR_DEFINITIONS ......

通过将 $(继承)添加到

,所有这3个错误都将消失
  1. 标题搜索路径
  2. 其他链接标志
  3. 预处理器宏
  4. 项目中的

    - >目标 - >构建设置

    现在命令会运行而不会出现任何错误

    pod install
    

答案 3 :(得分:20)

在您的项目中,找到SELECT S.SET_ID FROM SET_EQUIPMENT S GROUP BY S.SET_ID HAVING SUM(CASE WHEN S.EQ_ID = 1 THEN 1 ELSE 0 END) > 0 AND SUM(CASE WHEN S.EQ_ID = 2 THEN 1 ELSE 0 END) > 0 AND SUM(CASE WHEN S.EQ_ID = 3 THEN 1 ELSE 0 END) > 0; ,选择Target -> Build Settings -> Other Linker Flags,按Other Linker Flags(Mac键盘)/ delete(普通键盘)恢复设置。它对我有用。

示例:

enter image description here

enter image description here

答案 4 :(得分:19)

在我运行pod install时遇到类似问题,我看到以下警告/错误(与CLANG_CXX_LIBRARY相关):

来自Cocoapods的错误/警告

[!] The `Project [Debug]` target overrides the `CLANG_CXX_LIBRARY` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The `Project [Release]` target overrides the `CLANG_CXX_LIBRARY` build setting defined in `Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

修复

  1. 选择Project,以便查看Build Settings
  2. 选择TargetAppName下的Targets
  3. 查找C++ Standard Library(可能会在 BOLD - 这意味着它被覆盖了。)
  4. 选择行(因此它突出显示为蓝色),然后按⌘+ DELETE (Command + Backspace)
  5. 该行不应再加粗,如果您运行pod install,警告/错误应该已经消失。

    视觉援助

    CLANG_CXX_LIBRARY Error/Warning with Cocoapods

答案 5 :(得分:12)

如果Xcode在链接时抱怨,例如找不到-lPods的库,它不会检测隐式依赖项:

转到产品>编辑方案 单击Build 添加Pods静态库 清理并再次构建

答案 6 :(得分:7)

对我来说,问题在于我的目标测试。我的主应用目标中已经有pod install标记。

我将它添加到MyAppTests其他链接器标志。之后,当我运行{{1}}时,警告消息消失了。 enter image description here

答案 7 :(得分:6)

以下第一行链接节省了我的一天:

  

要从项目的构建设置中为选项添加值,请在值列表前加上$(继承)。

https://github.com/CocoaPods/CocoaPods/wiki/Creating-a-project-that-uses-CocoaPods#faq

另外,不要忘记在pod文件的开头插入此行:

platform :iOS, '5.0'

答案 8 :(得分:5)

我添加了$(继承)但我的项目仍未编译。对我来说问题是旗帜"仅针对活动架构构建",我必须将其设置为YES。

答案 9 :(得分:0)

不要忘记在pod文件的开头插入(或取消逗号分隔)这一行:

platform :iOS, '9.0'

这可以挽救我的生活

答案 10 :(得分:0)

每次我将pod添加到podfile中时,这种情况都会发生。

我不断地尝试发现问题,但是我一次又一次地转圈!

错误消息范围很大,但是每次修复方法都相同!

注释(#)podfile中的所有pod,并在终端中运行pod install。

然后...

取消注释Podfile中的所有Pod,然后再次运行pod install。

这每次都对我有用!

答案 11 :(得分:0)

当我将 $(inherited) 标志添加到相关文件(在本例中为 LIBRARY_SEARCH_PATHS)时,它导致了另一个错误 Undefined symbols for architecture arm64: "_swift_getTypeByMangledNameInContextInMetadataState

更改以下内容有效,我能够构建:

>LIBRARY_SEARCH_PATHS = (
   "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
-  "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"", <--- Change this...
+  "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.2/$(PLATFORM_NAME)\"", <--- to this
   "\"$(inherited)\"",
> );
相关问题