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

“Use of '@import' when modules are disabled” Error for FirebaseUiAuth #875

Closed
audkar opened this issue Jun 17, 2020 · 5 comments
Closed

Comments

@audkar
Copy link
Contributor

audkar commented Jun 17, 2020

Step 1: Are you in the right place?

80% chance 🤔

Step 2: Describe your environment

  • Objective C or Swift: Swift5
  • iOS version: 13.5
  • Firebase SDK version: 6.6
  • FirebaseUI version: 8.4.0
  • CocoaPods Version: 1.9.1

Step 3: Describe the problem:

Using FirebasUI dependencies in kotlin-native with cocoapods support throws error during compilation.
Not sure if valid fix, but if I replace module imports in FirebaseUI code then our project compiles successfully.

  • @import UIKit; => #import <UIKit/UIKit.h>
  • @import Foundation => #import <Foundation/Foundation.h>

edit:

  • setting Enable modules (C and Object-c) is true for project.
  • cacaopods Podfile contains use_frameworks! :linkage => :static

Steps to reproduce:

  1. Add 'FirebaseUI/Google dependency to to kotlin-native project
  2. Execute gradle podspec cmd
  3. Execute pod install
  4. Build iOS project
  5. Observe error

Observed Results:

Use of '@import' when modules are disabled

error is thrown in 3 places:

Expected Results:

Successful compilation

@schramm
Copy link

schramm commented Jul 12, 2020

Hi. I am having the same issue building FirebaseUI for iOS, mixing C++ and ObjectiveC. No idea how to fix this. Any help?
Edit: I managed to fix it following @audkar suggestion. I am not sure about further implications of replacing @import by #import. Anyways, It would be handy if the FirebaseUI team replaces the source with these modifications to make the framework compatible with Objective-C++ code.

@audkar
Copy link
Contributor Author

audkar commented Aug 8, 2020

@morganchen12 would you accept PR which replaces these imports?

@morganchen12
Copy link
Contributor

Yes, PRs are very welcome.

@jinyuyoulong
Copy link

https://answers.unity.com/questions/1679641/use-of.html

need c++ flag setup

@top-master
Copy link

top-master commented Jun 16, 2021

Using -fmodules and -fcxx-modules flags fixes this as long as the file extension is .m
(but not supported by .mm or rather Objective-C++ yet, year 2021).

Note that I tested with both g++ and clang++ compilers (as I really wanted to make this work).

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

No branches or pull requests

5 participants