Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inhibit_all_warnings! not work for header files in CocoaPods v1.6.0.beta.2 #8219

Closed
Whirlwind opened this issue Oct 24, 2018 · 22 comments
Closed
Labels
s1:awaiting input Waiting for input from the original author s6:need sample Needs a sample project that reproduces the issue

Comments

@Whirlwind
Copy link
Contributor

Whirlwind commented Oct 24, 2018

I have a project with CocoaPods v1.5.3, and everything is OK. I use the inhibit_all_warnings! in my Podfile. There are some warnings in my project and development pods, and there is not any warning in the Pods group.

I upgrade the CocoaPods to v1.6.0.beta.2, there are too many warnings:

  1. -Wnullability-completeness: many completeness nullability warnings from the Pods will show in my project.
  2. -Wdocument-comments : many document params warning in the header files from the Pods will show in my project.
  3. -Wstrict-prototypes: many interface method with block paramter have this warning in the Pods. like this block declaration is not a prototype.

These warnings are in the header files from the Pods, and show in my project. Because my project set treat warning as error, it will cause too many error when I build.

@dnkoutso
Copy link
Contributor

Probably related to #6401 /cc @guillaumealgis

@dnkoutso dnkoutso added this to the 1.6.0 milestone Oct 24, 2018
@guillaumealgis
Copy link
Contributor

Hi @Whirlwind, thank you for taking the time to test the beta and report this :)

Are you using use_modular_headers! in your Podfile?
Also, would you be able to share your project and / or your Podfile? Thanks!

@Whirlwind
Copy link
Contributor Author

I do not use the use_modular_headers! or use_frameworks!.

My project is too large and it could not be shared. : (

@guillaumealgis
Copy link
Contributor

guillaumealgis commented Oct 24, 2018

@Whirlwind is sharing your Podfile a possibility though? I think that would help me reproduce the issue and understand what is wrong.

Also, couple more questions:

  • Is your project written in Swift / Objective-C / Both?
  • If in Objective-C, how are you including the headers producing warnings? #import "ThePodHeader.h", #import <ThePodHeader.h>, or @import "ThePodHeader.h"?
  • Have you tried doing a clean build / completely removing ~/Library/Developer/Xcode/DerivedData?

Thank your for your time!

@Whirlwind
Copy link
Contributor Author

  • My project is written in Objective-C only.
  • Use #import "xxx.h" and #import <xx/xx.h>.
  • Clean done.

But I create a new project, and I could not reproduce it. I will check again.

There are some screenshots in my project:

First, I use inhibit_all_warnings!.

The BDSimplePlayer is a pod, it get a warning:
qq20181024-220641 2x
qq20181024-220624 2x
qq20181024-220524 2x

The AWECommerca.default-Alipay is a development pod, it get many warnings:
qq20181024-221609 2x
qq20181024-221550 2x
qq20181024-221536 2x

@guillaumealgis
Copy link
Contributor

guillaumealgis commented Oct 24, 2018

@Whirlwind libextobjc being one of the Pods I tested while working on this patch I'm surprised it doesn't work.

I tested just now with a minimal project with the following Podfile, and warnings are silenced as expected :

source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '12.0'
inhibit_all_warnings!

target 'CocoaPodsIssue8219' do
  pod 'libextobjc'
end

Since you cannot reproduce either with a fresh project, I'm thinking this a cache somewhere in your Xcode's internals not being cleared.

Did you try closing Xcode, fully removing ~/Library/Developer/Xcode/DerivedData (with rm -rf), opening your project and building again?

If you're still getting the warnings, would you mind copying the content of the .xcconfig of the problematic Pods here please? These should be in the Pods/Target Support Files/<name of the Pod> folders.
For example for libextobjc the .xcconfig is at Pods/Target Support Files/libextobjc/libextobjc.xcconfig.

Thank you for your help!

@dnkoutso
Copy link
Contributor

And thank you @guillaumealgis for the follow up!

@dnkoutso
Copy link
Contributor

dnkoutso commented Nov 1, 2018

ping @Whirlwind

@Whirlwind
Copy link
Contributor Author

I still get these warning (treat as error) from the Pods.xcodeproj, but I could not get them in a demo app. Others in my team get these error, too. And everything is OK in CocoaPods v1.5.3. I will wait other people to report same issue.

@dnkoutso dnkoutso removed this from the 1.6.0 milestone Nov 6, 2018
@dnkoutso dnkoutso added s1:awaiting input Waiting for input from the original author s6:need sample Needs a sample project that reproduces the issue labels Nov 6, 2018
@stale stale bot removed the s1:awaiting input Waiting for input from the original author label Nov 6, 2018
@dnkoutso dnkoutso added the s1:awaiting input Waiting for input from the original author label Nov 6, 2018
@guillaumealgis
Copy link
Contributor

@Whirlwind can you please share the .xcconfig of the Pods emitting warnings in your project (see my previous comment)? That would help me diagnose the problem and fix it.
Thanks!

@stale stale bot removed the s1:awaiting input Waiting for input from the original author label Nov 6, 2018
@Whirlwind
Copy link
Contributor Author

I check very many test files, and I found that #import <xx/yy.h> works, and #import <yy.h>, #import "yy.h" not works.

@guillaumealgis
Copy link
Contributor

Thank you for the follow up @Whirlwind. The 3 syntaxes you listed should work as expected on the 1.6.0 beta. What you're observing is not a normal behavior.

Unfortunately, without a sample project reproducing the issue or your .xcconfig files, I can't really help you get rid of the warnings. Could you please share the .xcconfig files Cocoapods is generating for your project please?
These are located in Pods/Target Support Files/ and do not contain any sensible / private data on your project.

Thank you!

@dnkoutso
Copy link
Contributor

Still need sample here.

@dnkoutso dnkoutso added the s1:awaiting input Waiting for input from the original author label Dec 12, 2018
@stale
Copy link

stale bot commented Dec 19, 2018

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem 👍

@stale stale bot closed this as completed Dec 19, 2018
@dnkoutso dnkoutso reopened this Jan 1, 2019
@stale stale bot removed the s1:awaiting input Waiting for input from the original author label Jan 1, 2019
@shixiaoda
Copy link

i have same issues。
this is UMCAnalytics.xcconfig.

CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/UMCAnalytics FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/UMCAnalytics" "${PODS_ROOT}/UMCCommon" GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 PODS_BUILD_DIR = ${BUILD_DIR} PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_ROOT = ${SRCROOT} PODS_TARGET_SRCROOT = ${PODS_ROOT}/UMCAnalytics PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} SKIP_INSTALL = YES

@jtreanor
Copy link
Contributor

jtreanor commented Apr 1, 2019

I am seeing the same issue when upgrading from 1.5.3 to 1.6.1. It only happens when using Xcode 10.2.

You can see the issue on this PR for the WordPress iOS app.

From the build log:

/Users/distiller/Library/Developer/Xcode/DerivedData/WordPress-anjhhjuqxtausqfqfoyxdzfcolgc/Build/Products/Debug-iphonesimulator/WPMediaPicker/WPMediaPicker.framework/Headers/WPMediaPickerViewController.h:315:21: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)

- (UIViewController *)defaultEmptyViewController;

Here are the contents of WPMediaPicker.xcconfig:

CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/WPMediaPicker
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
OTHER_LDFLAGS = $(inherited) -framework "AVFoundation" -framework "ImageIO" -framework "Photos" -framework "UIKit"
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}
PODS_TARGET_SRCROOT = ${PODS_ROOT}/WPMediaPicker
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
SKIP_INSTALL = YES

This is just one example. I am seeing warnings from several pods.

A similar issue is described in launchdarkly/ios-client-sdk#167.

@amorde
Copy link
Member

amorde commented Apr 8, 2019

If you can narrow it down to a small sample project that would be super helpful! It's difficult to try to dig through issues & PRs from other projects to figure out what we need to do to reproduce the bug, and self-contained example project really help in narrowing down what the bug might be

@jtreanor
Copy link
Contributor

I still haven't been able to reproduce this in a sample project but I have learned a little more so sharing here.

The warnings are only appearing on our test target, which does not directly depend on the pod. Here is a simplified version of the Podfile:

target 'WordPress' do
  pod 'WPMediaPicker', '1.3.2'

  target 'WordPressTest' do
        inherit! :search_paths
  end
end

As expected from #6401, WordPress has -isystem "${PODS_CONFIGURATION_BUILD_DIR}/WPMediaPicker/WPMediaPicker.framework/Headers" in OTHER_CFLAGS and this seems to be preventing the warnings from appearing on that target.

However, since WordPressTest does not directly depend on WPMediaPicker it doesn't have the -isystem flag and the warnings are still shown.

As some confirmation, if I change the Podfile to this it seems to work:

target 'WordPress' do
  pod 'WPMediaPicker', '1.3.2'

  target 'WordPressTest' do
      inherit! :search_paths
      pod 'WPMediaPicker', '1.3.2'
  end
end

Should the -isystem changes from #6401 be extended to test targets like this?

@stale
Copy link

stale bot commented Jul 14, 2019

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

@stale stale bot added the s1:awaiting input Waiting for input from the original author label Jul 14, 2019
@stale
Copy link

stale bot commented Jul 21, 2019

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem 👍

@stale stale bot closed this as completed Jul 21, 2019
@blastervla
Copy link

Just in case anyone else has this issue, I found that this workaround worked for me: #209 (comment)

I edited the snippet a bit as it wasn't working for my cocoapods version as it was. I ended up with:

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['GCC_WARN_INHIBIT_ALL_WARNINGS'] = "YES"
            config.build_settings['IBC_WARNINGS'] = "NO"
            config.build_settings['CLANG_WARN_DOCUMENTATION_COMMENTS'] = "NO"
            config.build_settings['WARNING_CFLAGS'] ||= ['"-Wno-nullability-completeness"']
            config.build_settings['WARNING_CFLAGS'] ||= ['"-Wno-nonnull"']

            # Disable nullability completeness warning for all headers
            pod_framework_umbrella_file = File.join(installer.config.project_pods_root, "Target\ Support\ Files/#{target.name}/#{target.name}-umbrella.h")
            if File.exist?(pod_framework_umbrella_file)
                pod_framework_umbrella_content = File.read(pod_framework_umbrella_file)
                pod_framework_umbrella_content.prepend(
                    <<~END
                    #pragma GCC diagnostic push
                    #pragma GCC diagnostic ignored \"-Wnullability-completeness\"\n
                    #pragma GCC diagnostic ignored \"-Wdocumentation\"\n
                    #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"\n
                    END
                )
                pod_framework_umbrella_content.concat(
                    <<~END
                    #pragma GCC diagnostic pop
                    END
                )
                File.open(pod_framework_umbrella_file, "w") { |file| file.puts pod_framework_umbrella_content }
            end
        end
    end
end

Hope this helps someone! 😄

@Tlz-1994
Copy link

So has this question been resolved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s1:awaiting input Waiting for input from the original author s6:need sample Needs a sample project that reproduces the issue
Projects
None yet
Development

No branches or pull requests

8 participants