ChatGPT解决这个技术问题 Extra ChatGPT

The target ... overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig

I have incorporate SpatialIite into a Xcode project which uses a header file from Proj.4, just one header. Both are Xcode projects and have static targets.

I'm trying to migrate from git submodule to Cocoapods. Since static targets seems to be difficult to use with Cocoapods, I just want to have the project built in the usual way. I made podspec for Proj.4. After writing podfile for SpatialLite I got the warnings:

[!] 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.

I read this issue but I'm pretty clueless to what the warnings mean and what can I do to fix it.

Additionally problem, when I open the workspace as well as opening SpatiaLite project alone, both are targeted to Mac OSX 64, when it is suppose to be an iOS project. My podfile does say "platform :ios".

2020 - for anyone struggling with this annoying problem. It is really only caused by (Surprise! :) ) facebook. As explained HERE, firebase.google.com/docs/auth/ios/firebaseui "If you prefer, you can add only the Auth component and the providers you want to use..." once you eliminate the facebook option, there's no problem. :/

I
Idan

This definitely works most of the time:

Go to your target Build Settings -> Other linker flags -> double click . Add $(inherited) to a new line.

If you have problem with "...target overrides the GCC_PREPROCESSOR_DEFINITIONS build setting defined in..." then you must add $(inherited) to your target Build Settings -> Preprocessor Macros


I would extend this answer. If you have problem with "... target overrides the GCC_PREPROCESSOR_DEFINITIONS build setting defined in ..." then you must add $(inherited) to your target Build Settings -> Preprocessor Macros
i suspect that "... target overrides the INSERT_YOUR_MISSING_DEFINITION..." then you must add $(inherited) to it. oddly though, my xcode was showing $(inherited) a bit faint as by default. i edited and simply retyped the same thing. error disappeared..
@joe Still not working for me. I tried all these suggestions, but when I rerun pod install, the errors persist. I made the changes to both other linker flags and to preprocessor macros. In both cases, nothing shows until you double click on each of the lines in other linker flags and preprocessor macros. Then you can see that $(inherited) has been added. I tried deleting and readding. I tried closing and reopening xcode. Nothing fixes the error messages when I type in pod install.
@msmq It's been a long time now, but do you remember the workaround that you tried and got it working? $(inherited) is already there at the top line but it doesn't work for me :/
i have added it stil pod install throws the same error.
j
jscs

There is a conflict between your build settings and the default build settings that Cocoapods wants. To see the Cocoapods build settings, view the .xcconfig file(s) in Pods/Target Support Files/Pods-${PROJECTNAME}/ in your project. For me this file contains:

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

If you are happy with the Cocoapods settings, then go to Build Settings for your project, find the appropriate setting and hit the Delete key. This will use the setting from Cocoapods.

On the other hand, if you have a custom setting that you need to use, then add $(inherited) to that setting.


I had this problem as well, I was able to remove the -ObjC and that fixed this problem. However, when I attempted to build the project, I get an error suggesting that the target specific pod library can not be found: "ld: library not found for -lPods-MyProject". Did you see something similar?
I'm run into this again. I'm not sure $(inherited) means. Where do I add it?
@RodericCampbell I have found that removing -ObjC from the project works fine for me and I don't see your error.
Hmm, but I need the -ObjC flag for it at runtime since I got categories.
OTHER_LDFLAGS = Other Linked Flags, HEADER_SEARCH_PATHS = Header Search Paths, GCC_PREPROCESSOR_DEFINITIONS = Preprocessor Macros. @kraftydevil, what setting are you trying to delete?
z
zeeawan

I've seen these 3 errors for pod command in terminal

pod install

[!] The MY_APP [Debug/Release] target overrides the HEADER_SEARCH_PATHS ... [!] The MY_APP [Debug/Release] target overrides the OTHER_LDFLAGS ... [!] The MY_APP [Debug/Release] target overrides the GCC_PREPROCESSOR_DEFINITIONS ...

All these 3 errors would be gone by adding $(inherited) to

Header Search Paths Other Linker Flags Preprocessor Macros

in Project -> Target -> Build Settings

And now the command would run without giving any errors

pod install

The above worked for me, when simply changing the flag for Other Linker Flags wasn't sufficient.
A
Anil

Just had a similar issue when I ran pod install, I saw the following warnings/errors (related to CLANG_CXX_LIBRARY):

The Error/Warning from 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.

The Fix

Select your Project so you can see the Build Settings. Select your Target (AppName under Targets) Find C++ Standard Library (It will probably be in BOLD - This means it's overridden). Select the Line (So it's highlighted Blue), and press ⌘ + DELETE (Command + Backspace)

The line should not be bolded anymore and if you run pod install the warnings/errors should have disappeared.

Visual Aid

https://i.stack.imgur.com/PEvCc.jpg


S
SamirChen

In your project, find Target -> Build Settings -> Other Linker Flags, select Other Linker Flags, press delete(Mac Keyboard)/Backspace(Normal keyboard) to recover the setting. It works for me.

Example:

https://i.stack.imgur.com/M3V6J.png

https://i.stack.imgur.com/CG7fH.png


do we remove the settings already located in Other Linker Flags ? or do we keep them and also add $(inherited) ??
A
Andreas Olsson

For me the problem was with my targets tests. I already had the $(inherited) flag in my main app target.

https://i.stack.imgur.com/oVPG1.png


A
Amit Saxena

If Xcode complains while linking, e.g. Library not found for -lPods, it doesn't detect the implicit dependencies:

Go to Product > Edit Scheme Click on Build Add the Pods static library Clean and build again


I tried the way you suggested, but its not showing the recent installed frameworks by pod file, any more suggestions to fix linker flag errors. @Amit Saxena
This worked for me when getting the same types of errors with the Pods for the cordova-plugin-facebook4 plugin in My Ionic 5/Cordova 9 app. I added all three of the Facebook frameworks, cleaned an presto! Works now on Xcode simulators but not yet on actual devices (I'm using an iPhone 6 with iOS 12.4.8 and Xcode 11.6).
n
newenglander

The first line of link below saved my day:

To add values to options from your project’s build settings, prepend the value list with $(inherited).

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

Also, do not forget to insert this line at the beginning of your pod file:

platform :iOS, '5.0'

in my case this saves my day : do not forget to insert this line at the beginning of your pod file: platform :iOS, '5.0'
s
sanjana

I added $(inherited) but my project was still not compiling. For me problem was flag "Build for active Architecture only", I had to set it to YES.


if are project is compiling can we just ignore the warnings ?
A
Amer Alzibak

do not forget to insert (or unCommanet) this line at the beginning of your pod file:

platform :iOS, '9.0'

that saves my day


Wrong. It has to be platform: ios, '9.0' and it doesn't solve the problem.
d
daj mi spokój

This happens to me every time I add a pod to the podfile.

I constantly try and find the problem but I just go round in circles again and again!

The error messages range, however the way to fix it is the same every time!

Comment out(#) ALL of the pods in the podfile and run pod install in terminal.

Then...

Uncomment out all of the pods in the podfile and run pod install again.

This has worked for me every single time!


This didn't help.
N
NathanNovak

When I added the $(inherited) flag to the file in question (in this case it was LIBRARY_SEARCH_PATHS) it led to another error Undefined symbols for architecture arm64: "_swift_getTypeByMangledNameInContextInMetadataState

Changing the following worked and I was able to build:

>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)\"",
> );