Skip to content

Xcode build error: include of non-modular header inside framework module #15173

Closed

Description

@kozw

Steps to Reproduce

Create a plugin package as per the documentation using Swift in iOS and build it for ios:

flutter create --template=plugin -i swift hello
cd hello/example
flutter build ios --no-codesign

Logs

...
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **

Xcode's output:
↳
    === BUILD TARGET hello OF PROJECT Pods WITH CONFIGURATION Release ===
    <module-includes>:1:9: note: in file included from <module-includes>:1:
    #import "Headers/hello-umbrella.h"
            ^
    xxx/hello/example/ios/Pods/Target Support Files/hello/hello-umbrella.h:13:9: error: include of non-modular header inside framework module 'hello': 'xxx/hello/ios/Classes/HelloPlugin.h'
    #import "HelloPlugin.h"
            ^
    <unknown>:0: error: could not build Objective-C module 'hello'

Recently upgraded to flutter beta. I've created plugin packages before in the alpha channel without problems.

Flutter Doctor

[✓] Flutter (Channel beta, v0.1.5, on Mac OS X 10.13.3 17D102, locale en-NL)
    • Flutter version 0.1.5 at /Users/kozw/Source/flutter
    • Framework revision 3ea4d06340 (11 days ago), 2018-02-22 11:12:39 -0800
    • Engine revision ead227f118
    • Dart version 2.0.0-dev.28.0.flutter-0b4f01f759

[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at /Users/kozw/Library/Android/sdk
    • Android NDK at /Users/kozw/Library/Android/sdk/ndk-bundle
    • Platform android-27, build-tools 27.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)

[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 9.2, Build version 9C40b
    • ios-deploy 1.9.2
    • CocoaPods version 1.4.0

[✓] Android Studio (version 3.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)

[✓] VS Code (version 1.20.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Dart Code extension version 2.9.2

[✓] Connected devices (1 available)
    • iPhone 8 • D5FC98FA-D6B0-41D2-B834-B7FFFEB1B506 • ios • iOS 11.2 (simulator)

Activity

  1. willks commented on Mar 7, 2018

    @willks

    I get this too when trying to make a Swift plugin inside the flutter project. I'm using the command:

    flutter create --template=plugin -i swift -a kotlin cbdb
    

    and I get the same error sans file path:

    xxx/cbdb/example/ios/Pods/Target Support Files/cbdb/cbdb-umbrella.h:13:9: Include of non-modular header inside framework module 'cbdb': 'xxxx/cbdb/ios/Classes/CbdbPlugin.h'
    

    Pretty much renders us making plugins in Swift as a no go. This is critical for us as the Flutter community for plugins is young, and we need plugin builders. I personally am trying to make a wrapper for Couchbase-Lite 2.0.0B, so that we have a proper JSON store with search capability for 100% offline apps in iOS and Android.

    I don't get this error in ObjC tests but we're not going near ObjC.

    Thanks for the great work so far BTW - Flutter is awesome!

  2. kozw commented on Mar 9, 2018

    @kozw
    Author

    Looks like the created Podfile is the culprit. When I remove Podfile.lock and replace Podfile in the example/ios folder with a version I took from the flutter alpha branch, the build succeeds.

    Attached the Podfile from the alpha branch if you want to try it out for yourself (make sure you remove Podfile.lock first). Disclaimer: I'm no Xcode build expert, I'm unaware of any unwanted side effects. Use at your own risk. This issue should be addressed by the flutter team.

    Podfile.zip

  3. gahfy commented on Mar 11, 2018

    @gahfy

    @kozw You saved my life!!! Thanks

  4. willks commented on Mar 11, 2018

    @willks

    @kozw Thanks for working around it. As an iOS dev (Swift) - I'm now doing Android dev to prove the Flutter PoC for our company. Seriously, not easy to wrap CouchBase Lite :) i'm 70% there.

  5. kozw commented on Mar 24, 2018

    @kozw
    Author

    Looks like the issue is resolved in the master branch. See also #15763

  6. kozw commented on Apr 11, 2018

    @kozw
    Author

    Scratch that, error still exists in Flutter beta v0.2.8

  7. kozw commented on Apr 11, 2018

    @kozw
    Author

    Looks like the real solution can be found here => #16049

  8. added
    p: toolingAffects the flutter_plugin_tools package
    toolAffects the "flutter" command-line tool. See also t: labels.
    and removed on Dec 6, 2018
  9. added this to the milestone on Dec 6, 2018
  10. zoechi commented on Dec 21, 2018

    @zoechi
    Contributor

    Duplicate of #16049

  11. github-actions commented on Aug 15, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  12. locked as resolved and limited conversation to collaborators on Aug 15, 2021
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

    c: crashStack traces logged to the consolep: toolingAffects the flutter_plugin_tools packageplatform-iosiOS applications specificallytoolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions