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

“Include of non-modular header inside framework module” error in project with framework sub-dependency #192

Closed
marchy opened this issue Oct 31, 2015 · 15 comments
Assignees

Comments

@marchy
Copy link

marchy commented Oct 31, 2015

The following error shows up on several Bolts library files when including a framework in a project which it itself requires Bolts.
Compilation error: “Include of non-modular header inside framework module”

This seems to be caused by the fact that header files are included directly in .h files instead of the correct Objective-C approach of specifying @Class and @protocol in the header and doing the actual include only in the .m file (see thread here for exact problem: http://stackoverflow.com/questions/28552500/xcode6-receiving-error-include-of-non-modular-header-inside-framework-module)

It looks like the Bolts code should be updated on these files with the correct Objective-C pattern in order to allow upper-level projects to correctly include frameworks that use Bolts as a sub-dependency.

marchy added a commit to marchy/Bolts-iOS that referenced this issue Oct 31, 2015
…frameworks which themselves include Bolts to work without running into “Include of non-modular header inside framework module” compilation errors.
@marchy marchy mentioned this issue Oct 31, 2015
@nlutsenko
Copy link
Member

@marchy Not sure why this is breaking for you, as we have Parse SDK that uses Bolts Tasks everywhere and it doesn't require this change, nor does Facebook SDK.

From what comes to my mind - maybe you don't have Defines Module: YES in the build settings of your framework?

@nlutsenko nlutsenko self-assigned this Nov 2, 2015
@marchy
Copy link
Author

marchy commented Nov 2, 2015

Okay, it looks like Defines Module: YES was not enabled on the framework project (strange that the framework project template doesn't turn this on automatically), however this still hasn't solved the issue.

Additionally, while compiling the framework itself works (in both debug and release configurations), running a podspec validation fails with the same error:

(14 failures)
 -> Oil (0.1.0)
    - ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code.
    - NOTE  | xcodebuild:  <module-includes>:1:9: note: in file included from <module-includes>:1:
    - NOTE  | xcodebuild:  Target Support Files/Bolts/Bolts-umbrella.h:3:9: note: in file included from Target Support Files/Bolts/Bolts-umbrella.h:3:
    - ERROR | xcodebuild:  Bolts/Bolts/Common/BFCancellationToken.h:13:9: error: include of non-modular header inside framework module 'Bolts.BFCancellationToken'
    - NOTE  | xcodebuild:  Target Support Files/Bolts/Bolts-umbrella.h:10:9: note: in file included from Target Support Files/Bolts/Bolts-umbrella.h:10:
    - ERROR | xcodebuild:  Bolts/Bolts/Common/Bolts.h:11:9: error: include of non-modular header inside framework module 'Bolts.Bolts'
    - ERROR | xcodebuild:  Oil/Oil/RemoteOperation.swift:7:8: error: could not build Objective-C module 'Bolts'
    - NOTE  | xcodebuild:  clang: error: linker command failed with exit code 1 (use -v to see invocation)
    - NOTE  | [iOS] xcodebuild:  fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't open input file: /var/folders/rh/94g2hqsn6k5bzj83scwvxsd80000gn/T/CocoaPods/Lint/build/Pods.build/Release-iphonesimulator/Oil.build/Objects-normal/i386/Oil (No such file or directory)
    - NOTE  | [iOS] xcodebuild:  error: cannot parse the debug map for "/var/folders/rh/94g2hqsn6k5bzj83scwvxsd80000gn/T/CocoaPods/Lint/build/Release-iphonesimulator/Oil.framework/Oil": No such file or directory

[!] The `Oil.podspec` specification does not validate.

@marchy
Copy link
Author

marchy commented Nov 2, 2015

Pull request ready: #193

@nlutsenko
Copy link
Member

@marchy Any chance you can specify the version of the CocoaPods that you are using to validate your podspec? Once again - we have Parse SDK that has the podspec and everything and it doesn't have these problems.

If you are running into this on the latest version of CocoaPods - my take would be that it's a problem with CocoaPods, since this is an absolutely valid use case and #193 shouldn't be required for anything.

@marchy
Copy link
Author

marchy commented Nov 4, 2015

Version is 0.39.0 – latest, non-beta

In regards to accepting the pull request, it's these 3 files alone that cause issues and break whatever is causing the non-modular problems above. Would appreciate if you could accept these or make adjustments as necessary – we are currently blocked due to these issues until this gets merged in. I understand it may work in your guys' particular setup, but that doesn't make these problems invalid or somehow not existent for others.

I can also send you a copy of our library project if you like. Let me know and I can send you a zipped copy. Running a "pod repo push" will manifest the problem.

@nlutsenko
Copy link
Member

in your guys' particular setup

I'd like to point out that we have Parse SDK, ParseFacebookUtils, ParseTwitterUtils, ParseUI and Facebook SDK depending on Bolts pod and neither of those have this problem.

There is an ongoing issue with CocoaPods 0.39 - CocoaPods/CocoaPods#4420
that might be relevant to this.

@honghaoz
Copy link

honghaoz commented Dec 1, 2015

@nlutsenko parse-community/Parse-SDK-iOS-OSX#613 I think this issue is related

@honghaoz
Copy link

honghaoz commented Dec 1, 2015

@nlutsenko CocoaPods/CocoaPods#4420 this issue has been closed. Any idea to this issue now?

@nlutsenko
Copy link
Member

CocoaPods/CocoaPods#4420 is available from master on CocoaPods, could you try it?

@AJ
Copy link

AJ commented Mar 21, 2016

I just installed Cocoapods-0.39 and I'm facing this issue as well. However, I'm not seeing this in the Bolts framework but in the base Parse Framework itself (In Parse.h).

I'm a very new Swift developer so perhaps I'm confusing the above. But the errors do show up in Parse.h for me. This might be a moot point at this time considering parse is shutting down. Not sure if this issue impacts the new Open Source Parse server

@nlutsenko
Copy link
Member

@AJ, any chance you can try the new CocoaPods beta?
Install it with gem install cocoapods --pre.

@AJ
Copy link

AJ commented Mar 28, 2016

@nlutsenko I'll try this although I've managed to redo the piece of code I was working on without this issue (It was just a starter app so I did it without these frameworks)

@nlutsenko
Copy link
Member

Hey everyone,

I would recommend trying to use latest beta of CocoaPods (you can install it by running gem install cocoapods --pre). Please let me know if you are still running into the issue with installing Bolts by commenting here, reopening this issue or creating a new one.

@drdaz
Copy link

drdaz commented Nov 1, 2016

This is still an issue both with the 1.1.1 version currently on main and the --pre branch.

I've tried deleting the Pods dir from my workspace to force cocoapods to reinstall my dependencies, but the result is the same.

Is there anything else I can do to trigger whatever actions / changes should have fixed this?

@drdaz
Copy link

drdaz commented Dec 6, 2016

@nlutsenko Is there anything I can do to help this issue along?

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

No branches or pull requests

5 participants