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

Default Xcode 12 settings fail to build CocoaPods-generate umbrella headers #9902

Closed
paulb777 opened this issue Jul 7, 2020 · 12 comments · Fixed by #9905
Closed

Default Xcode 12 settings fail to build CocoaPods-generate umbrella headers #9902

paulb777 opened this issue Jul 7, 2020 · 12 comments · Fixed by #9905
Milestone

Comments

@paulb777
Copy link
Member

paulb777 commented Jul 7, 2020

In Xcode 12 default options, CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER is set to Yes. This causes CocoaPods generated umbrella header files to fail with errors like:

Double-quoted include "FBLPromise+All.h" in framework header, expected angle-bracketed instead

Reported and additional discussion at firebase/firebase-ios-sdk#5987

Reproducible project:
testProject.zip

@dnkoutso
Copy link
Contributor

dnkoutso commented Jul 7, 2020

Should we set CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER to NO for all Pods build settings?

@paulb777
Copy link
Member Author

paulb777 commented Jul 7, 2020

Yes, that should be safer and easier than generating different content for the umbrellas.

@amorde
Copy link
Member

amorde commented Jul 7, 2020

Is Xcode 12 now expecting umbrella headers to use <> imports?

@paulb777
Copy link
Member Author

paulb777 commented Jul 7, 2020

Yes.

@amorde
Copy link
Member

amorde commented Jul 7, 2020

Interesting - makes sense I guess. Apple does that in their own frameworks

@jackguo709
Copy link

I just updated to Xcode 12 and am experiencing this issue. How should I resolve it? After the update, the project can initially be successfully built, with a lot of The iOS Simulator deployment target is set to 8.0 warnings. So I updated all of their targets to 12.0. Then this quoted imports error appeared.

I did the following in order, but still get the error.

gem install cocopoads,
rm -rf ~/Library/Developer/Xcode/DerivedData/
pod deintegrate
pod update

@swisscheesy
Copy link

swisscheesy commented Sep 18, 2020

I just updated to Xcode 12 and am experiencing this issue. How should I resolve it? After the update, the project can initially be successfully built, with a lot of The iOS Simulator deployment target is set to 8.0 warnings. So I updated all of their targets to 12.0. Then this quoted imports error appeared.

I did the following in order, but still get the error.

gem install cocopoads,
rm -rf ~/Library/Developer/Xcode/DerivedData/
pod deintegrate
pod update

Just upgraded Xcode and am unable to run my flutter app on Ios now as well. Looking for a fix

@paulb777
Copy link
Member Author

@jackguo709 @swisscheesy Update to CocoaPods 1.10. More details and options at https://stackoverflow.com/a/63648164/556617

@Bowzthefirst
Copy link

Thanks Paul

ilammy added a commit to ilammy/themis that referenced this issue Nov 4, 2020
Actually, decline most of the suggestions and just update the
LastUpgradeCheck so that Xcode stops nagging us for updates.

  - Keep building "arm64e" architecture for iOS.

    Xcode 12 wants to set ARCHS -- the architectures to build for --
    to just $(ARCHS_STANDARD). However, keep building the arm64e slice
    contrary to Xcode suggestions.

    arm64e is an architecture for Apple A12 chips which supports
    'pointer authentication' [1]. Keep building Themis for this
    architecture to ensure that it is supported.

    This architecture is only supported on the real iOS devices,
    iOS Simulator does not support it (even on Apple Silicon).
    It is also not supported on macOS.

    [1]: https://developer.apple.com/documentation/security/preparing_your_app_to_work_with_pointer_authentication

  - Build for all architectures, not just the active one.

    Xcode 12 suggests disabling ONLY_ACTIVE_ARCH to build code for all
    architectures at all time, presumable to ease the transition to Apple
    Silicon. We are already building for all archs in Release mode, do the
    same for Debug mode too, to make sure that we don't miss anything.

    However, make sure that arm64 builds are disabled for iOS Simulator
    in test targets too, just like they are disabled in the framework.

  - Ignore warnings about quotes includes in framework headers.

    Set CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER to NO. This
    new warning (enabled by default since Xcode 12) is known to break
    umbrella headers of frameworks. CocoaPods currently disables it [2].
    We do this as well since all those

        #import "objcthemis.h"

    in "src/wrappers/themis/Obj-C/Themis/themis.h" are causing this
    warning. Apparently, Xcode wants this to be changed to this:

        #import <objcthemis.h>

    but then in fails due to a missing file because the framework is not
    in the search path for itself. We *do intend* to include a header
    file from the current directory -- the framework header directory.
    It's not clear what Xcode wants from us here, so just follow the
    CocoaPods guidance for now and disable the warning. This does not
    affect compilation and later use of the framework in apps.

    [2]: CocoaPods/CocoaPods#9902

  - Keep iOS target at 10.0.

    Xcode 12 suggests to update the minimum supported iOS to 12.0, but
    we'll still support iOS 10 for this release so keep the old value.

  - Keep Swift 4 in tests for Swift 4.

    Do not upgrade SWIFT_VERSION in the targets which test Swift 4
    compatibility specifically, in spite Xcode wanting to do this.
ilammy added a commit to ilammy/themis that referenced this issue Nov 4, 2020
Actually, decline most of the suggestions and just update the
LastUpgradeCheck so that Xcode stops nagging us for updates.

  - Keep building "arm64e" architecture for iOS.

    Xcode 12 wants to set ARCHS -- the architectures to build for --
    to just $(ARCHS_STANDARD). However, keep building the arm64e slice
    contrary to Xcode suggestions.

    arm64e is an architecture for Apple A12 chips which supports
    'pointer authentication' [1]. Keep building Themis for this
    architecture to ensure that it is supported.

    This architecture is only supported on the real iOS devices,
    iOS Simulator does not support it (even on Apple Silicon).
    It is also not supported on macOS.

    [1]: https://developer.apple.com/documentation/security/preparing_your_app_to_work_with_pointer_authentication

  - Build for all architectures only in Release mode.

    Xcode 12.2 suggests enabling ONLY_ACTIVE_ARCH in Debug mode in order
    to improve build times. Release builds -- such as when archiving --
    will still build all architectures.

    However, make sure that arm64 builds are disabled for iOS Simulator
    in test targets too, just like they are disabled in the framework.

  - Ignore warnings about quotes includes in framework headers.

    Set CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER to NO. This
    new warning (enabled by default since Xcode 12) is known to break
    umbrella headers of frameworks. CocoaPods currently disables it [2].
    We do this as well since all those

        #import "objcthemis.h"

    in "src/wrappers/themis/Obj-C/Themis/themis.h" are causing this
    warning. Apparently, Xcode wants this to be changed to this:

        #import <objcthemis.h>

    but then in fails due to a missing file because the framework is not
    in the search path for itself. We *do intend* to include a header
    file from the current directory -- the framework header directory.
    It's not clear what Xcode wants from us here, so just follow the
    CocoaPods guidance for now and disable the warning. This does not
    affect compilation and later use of the framework in apps.

    [2]: CocoaPods/CocoaPods#9902

  - Keep iOS target at 10.0.

    Xcode 12 suggests to update the minimum supported iOS to 12.0, but
    we'll still support iOS 10 for this release so keep the old value.

  - Keep Swift 4 in tests for Swift 4.

    Do not upgrade SWIFT_VERSION in the targets which test Swift 4
    compatibility specifically, in spite Xcode wanting to do this.

squash! Update to Xcode 12.0.1 recommended settings

Xcode 12.2

keep building for active only in debug
ilammy added a commit to ilammy/themis that referenced this issue Nov 4, 2020
Actually, decline most of the suggestions and just update the
LastUpgradeCheck so that Xcode stops nagging us for updates.

  - Keep building "arm64e" architecture for iOS.

    Xcode 12 wants to set ARCHS -- the architectures to build for --
    to just $(ARCHS_STANDARD). However, keep building the arm64e slice
    contrary to Xcode suggestions.

    arm64e is an architecture for Apple A12 chips which supports
    'pointer authentication' [1]. Keep building Themis for this
    architecture to ensure that it is supported.

    This architecture is only supported on the real iOS devices,
    iOS Simulator does not support it (even on Apple Silicon).
    It is also not supported on macOS.

    [1]: https://developer.apple.com/documentation/security/preparing_your_app_to_work_with_pointer_authentication

  - Build for all architectures only in Release mode.

    Xcode 12.2 suggests enabling ONLY_ACTIVE_ARCH in Debug mode in order
    to improve build times. Release builds -- such as when archiving --
    will still build all architectures.

    However, make sure that arm64 builds are disabled for iOS Simulator
    in test targets too, just like they are disabled in the framework.

  - Ignore warnings about quotes includes in framework headers.

    Set CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER to NO. This
    new warning (enabled by default since Xcode 12) is known to break
    umbrella headers of frameworks. CocoaPods currently disables it [2].
    We do this as well since all those

        #import "objcthemis.h"

    in "src/wrappers/themis/Obj-C/Themis/themis.h" are causing this
    warning. Apparently, Xcode wants this to be changed to this:

        #import <objcthemis.h>

    but then in fails due to a missing file because the framework is not
    in the search path for itself. We *do intend* to include a header
    file from the current directory -- the framework header directory.
    It's not clear what Xcode wants from us here, so just follow the
    CocoaPods guidance for now and disable the warning. This does not
    affect compilation and later use of the framework in apps.

    [2]: CocoaPods/CocoaPods#9902

  - Keep iOS target at 10.0.

    Xcode 12 suggests to update the minimum supported iOS to 12.0, but
    we'll still support iOS 10 for this release so keep the old value.

  - Keep Swift 4 in tests for Swift 4.

    Do not upgrade SWIFT_VERSION in the targets which test Swift 4
    compatibility specifically, in spite Xcode wanting to do this.
ilammy added a commit to cossacklabs/themis that referenced this issue Nov 5, 2020
* Update to Xcode 12.2 recommended settings

Actually, decline most of the suggestions and just update the
LastUpgradeCheck so that Xcode stops nagging us for updates.

  - Keep building "arm64e" architecture for iOS.

    Xcode 12 wants to set ARCHS -- the architectures to build for --
    to just $(ARCHS_STANDARD). However, keep building the arm64e slice
    contrary to Xcode suggestions.

    arm64e is an architecture for Apple A12 chips which supports
    'pointer authentication' [1]. Keep building Themis for this
    architecture to ensure that it is supported.

    This architecture is only supported on the real iOS devices,
    iOS Simulator does not support it (even on Apple Silicon).
    It is also not supported on macOS.

    [1]: https://developer.apple.com/documentation/security/preparing_your_app_to_work_with_pointer_authentication

  - Build for all architectures only in Release mode.

    Xcode 12.2 suggests enabling ONLY_ACTIVE_ARCH in Debug mode in order
    to improve build times. Release builds -- such as when archiving --
    will still build all architectures.

    However, make sure that arm64 builds are disabled for iOS Simulator
    in test targets too, just like they are disabled in the framework.

  - Ignore warnings about quotes includes in framework headers.

    Set CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER to NO. This
    new warning (enabled by default since Xcode 12) is known to break
    umbrella headers of frameworks. CocoaPods currently disables it [2].
    We do this as well since all those

        #import "objcthemis.h"

    in "src/wrappers/themis/Obj-C/Themis/themis.h" are causing this
    warning. Apparently, Xcode wants this to be changed to this:

        #import <objcthemis.h>

    but then in fails due to a missing file because the framework is not
    in the search path for itself. We *do intend* to include a header
    file from the current directory -- the framework header directory.
    It's not clear what Xcode wants from us here, so just follow the
    CocoaPods guidance for now and disable the warning. This does not
    affect compilation and later use of the framework in apps.

    [2]: CocoaPods/CocoaPods#9902

  - Keep iOS target at 10.0.

    Xcode 12 suggests to update the minimum supported iOS to 12.0, but
    we'll still support iOS 10 for this release so keep the old value.

  - Keep Swift 4 in tests for Swift 4.

    Do not upgrade SWIFT_VERSION in the targets which test Swift 4
    compatibility specifically, in spite Xcode wanting to do this.

* Move common settings to project level

A lot of Xcode settings for targets are actually shared by all of them.
Having common settings specified for individual targets makes it hard
to update them as you can easily forget to update them everywhere. Let's
move all shared settings to the project level so that they can be easily
updated everywhere at once. Leave per-target overrides where necessary.

  - Build for iOS and iPadOS simultaneously.

    Keep TARGETED_DEVICE_FAMILY for iOS framework as "1,2" which marks
    both iOS and iPadOS as supported by default for all targets.

  - Use common versioning.

    Instead of iOS and macOS frameworks using separate versions, move
    the version variables to the project level: CURRENT_PROJECT_VERSION
    and MARKETING_VERSION. We also have no use for VERSION_INFO_PREFIX.

    Since we release iOS and macOS frameworks simultaneously, their
    versions should be updated simultaneously as well.

  - Use common warning settings.

    Move some of the additional compiler warnings to the project level
    so that they are enabled for all targets by default.

    This includes the "treat warnings as errors" policy which is now
    enabled for all targets.

  - Use common Swift compiler settings.

    All our targets use the same Swift compiler settings (except for
    Swift version). Move all of them to the project level, but keep
    the test targets using SWIFT_VERSION.

  - Use default code signing settings.

    Since we're building a framework here, it's not normally signed.
    The signature is applied only when archiving the complete app.
    Default settings use ad-hoc signing for integrity protection,
    but we should not hardcode development teams, etc.

  - Enable bitcode by default.

    Make sure that bitcode is enabled for all (iOS) targets by default.
    However, keep it disabled for tests. Test targets are built as
    bundles and they are not compatible with bitcode, causing ld errors:
    "-bundle and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES)
    cannot be used together".

  - Move miscellaneous settings to project level.

    Such as CLANG_ENABLE_MODULES. We don't really use Clang modules
    in our source code, but system headers use them and this somewhat
    speeds up compilation.

* Drop deprecated settings

Remove the settings which we don't really need.

  - Ignore high-DPI images.

    Remove COMBINE_HIDPI_IMAGES as none of our frameworks contains any
    image resources whatsoever. Xcode's default is fine for us.

  - Ignore user paths.

    Remove ALWAYS_SEARCH_USER_PATHS as it's marked deprecated since
    Xcode 8 and may be removed. It has no effect on out builds.

  - Remove unused Metal settings.

    Older Xcodes insisted on including MTL_ENABLE_DEBUG_INFO and
    MTL_FAST_MATH into new projects, but Themis does not use Metal
    so we don't really need those settings.

* Suppress non-null warnings in tests

Since now all warnings are treated as errors, those warnings in tests
are no longer tolerated. The tests intentionally pass NULL values to
parameters marked as "nonnull". Suppress the warnings here to test this
invalid behavior.
@libyasdf
Copy link

libyasdf commented Feb 2, 2021

Screen Shot 2021-02-02 at 11 51 43 AM

Screen Shot 2021-02-02 at 11 51 51 AM

Screen Shot 2021-02-02 at 11 52 03 AM

pod --version
1.10.1

but can't fixed this issue.

@paulb777
Copy link
Member Author

paulb777 commented Feb 2, 2021

@libyasdf Make sure to run pod deintegrate. See the stackoverflow link above.

@libyasdf
Copy link

libyasdf commented Feb 3, 2021

@libyasdf Make sure to run pod deintegrate. See the stackoverflow link above.

problem solved

  1. this time I used pod deintegrate

  2. pod install successes. (A few days ago, due to network reasons, there was a problem in this step. It's not true success before)

  3. This project must run on true iPhone.

  4. Actually, pod --version under the project directory is 1.9.3. I don't know why it's 1.10.1 outside. But it didn't affect the final result.

  5. I run pod repo-art add cocoa-remote https://.... to make a local repo, below the directory ~/.cocoapods/repos-art. But when I pod install, It's don't download using local resource —— it's cause the pod install frequent failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants