Skip to content

GoogleSignIn does not define a clang module, cannot @import GoogleSignIn when built as a library #32

Closed

Description

@jmagman

GoogleSignIn does not generate a clang module when built as a library instead of a framework. This forces users to use use_frameworks! in their Podfile, which isn't the default.

Steps to Reproduce

  1. Remove use_frameworks! from Sample Podfile to generate as a library
    use_frameworks!
  2. Open SignInSampleForPod.xcworkspace and build.

Compilation failure:

GoogleSignIn-iOS/Sample/Source/SignInViewController.h:19:9: Module 'GoogleSignIn' not found

Screen Shot 2021-07-20 at 11 06 43 AM

To fix

Add 'DEFINES_MODULE' => 'YES' to pod_target_xcconfig

s.pod_target_xcconfig = {
'GCC_PREPROCESSOR_DEFINITIONS' => 'GID_SDK_VERSION=' + s.version.to_s,
'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}"'
}

becomes:

 s.pod_target_xcconfig = { 
   'GCC_PREPROCESSOR_DEFINITIONS' => 'GID_SDK_VERSION=' + s.version.to_s, 
   'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}"',
   'DEFINES_MODULE' => 'YES'
 } 

See "Modular Headers" section of https://blog.cocoapods.org/CocoaPods-1.5.0/

Activity

  1. piercifani commented on Jul 28, 2021

    @piercifani

    Can we please fix this ASAP? This is breaking integration for many apps for versions 6.0 and up, and that version is required in order to use GSignIn in M1 Macs.

    This is unacceptable.

  2. paulb777 commented on Jul 28, 2021

    @paulb777
    Member

    A possible workaround is adding use_frameworks! :linkage => :static to the Podfile. See the discussion in #33 for more context.

  3. piercifani commented on Jul 28, 2021

    @piercifani

    Changing how all other Pods are built and linked sounds like a worse option than just add that flag to the Podspec to define the module, because it'll add a lot of uncertainty to all other libraries

  4. piercifani commented on Aug 11, 2021

    @piercifani

    Guys, is anyone going to do anything about this or do we have to figure this out on our own?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions