-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Don't include inttypes if compiling for Mac/iOS #3636
Don't include inttypes if compiling for Mac/iOS #3636
Conversation
This seems dodgy. This is the system-provided header, which is used to build libgit2 itself. If you're calling it from something else, this shouldn't have any effect. I would rather recommend stopping the inclusion of this file in your build system if it's causing those issues by defining |
It's included in the simulator environment there is no way I can stop it. 😬 |
If you can't stop this file from being included in the build, how does libgit2 not asking for it help? Is libgit2 having th |
The problem is that frameworks should not include external files in the header. I only know of this restriction in OS X/iOS frameworks. Other libraries have solved this issue by moving the import/include into the implementation file ( |
So it is the text of the include. That seems really odd. But this isn't the only header we include. We also Even so, I would much rather not rely on the OS specificiation, as this kind of thing changes with the whims of Apple's dev tools. We should be checking for |
Yeah, I tried that and it is including it because it is not defined before that so it is included and therefore generates the error. it seems to me that the types that are needed (not sure which, actually) are already defined and thus the import can be omitted. As I said other people have solved this by moving the imports. https://github.com/AFNetworking/AFNetworking/issues/2205 |
Ok, I updated the PullRequest, it seems to work if I check for |
edda9cb
to
b457a88
Compare
Yes, |
b457a88
to
fb83faf
Compare
👍 makes sense, added a comment. |
I asked around and it looks like this come from clang getting fancy and introducing modules in C. They (fortunately) accept that it's not realistic to change all the libraries we already have, so they allow for user-defined mappings between the include and the module. It unfortunately doesn't seem to include |
Yeah, I think thats the underlying issue. Are you referring to introducing a |
This is a system header, so it should be provided by the OS, but yeah, libgit2 or objective-git would presumably have to tell clang what to translate that header to in modules. |
3c1d91d
to
372cfba
Compare
/cc @joshaber where would be the place to add this kind of mapping? Should this be in the objective-git project? Or do we have to make clang happy ourselves? |
709af51
to
d8985a4
Compare
The problem is you can't tell the module map something like:
It will just complain that |
@carlosmn Sadly I don't know much about clang modules except that they're a world of pain 😞 |
I dug a bit more into this and found out that clang inttypes gets imported too and checking for it resolves the problem in objective-git. |
If clang is making it so hard to do anything else, let's go with the current version. Could you squash this all together into a single commit? |
This fixes an issue in Xcode 7.3 in objective-git where we get the error "Include of non-modular header file in module". Not importing this header again fixes the issue.
bbfa65e
to
0ac4a5d
Compare
@carlosmn Done! |
…in-module Don't include inttypes if compiling for Mac/iOS
In ObjectiveGit have recurring problems (see libgit2/objective-git#436 (comment) and libgit2/objective-git#542) with Xcode complaining with
Include of non-modular header inside framework module 'ObjectiveGit.git2.sys.filter'
this is due to the fact thatlibgit2
is includinginttypes.h
incommon.h
. There is no need to import this header on iOS and Mac platforms and thus I excluded it.This fixes our recurring compilation issues and still works. I am happy to discuss this change as it has some implications. I also find this way of solving the problem pretty naive but after days of trying is the only solution I could come up with.