Skip to content
This repository has been archived by the owner on Aug 30, 2020. It is now read-only.

Fixed the issue of C/C++ std headers not found #87

Merged
merged 2 commits into from
Oct 27, 2016

Conversation

leofang
Copy link

@leofang leofang commented Oct 24, 2016

In the FAQ of Valloric/YouCompleteMe, there is an issue of C/C++ standard library headers not found that affects some users (mainly on OS X) and has been resolved with a workaround, and @cpradog has kindly provided a working implementation.

Basically, what this workaround does is to execute echo | clang -v -E -x c++ -, as instructed by YouCompleteMe, extract the paths to where the standard headers reside, and append to the include path generated by .ycm_extra_conf.py. Therefore, it will not interfere with other functionalities.

Since rdnetto/YCM-Generator is recommended to use in the front page of Valloric/YouCompleteMe, it's probably worth incorporating this workaround for users' convenience.

Also, the 1st line #!/usr/bin/env python2 in config_gen.py is not universal, so it's changed to #!/usr/bin/env python.

…83ecfc6

In the FAQ of https://github.com/Valloric/YouCompleteMe, there was an
issue of C++ standard library headers not found (ycm-core/YouCompleteMe#303)
that has been resolved with a workaround, and @cpradog has kindly implemented it.

However, this workaround has not yet been incorporated into template.py
in https://github.com/rdnetto/YCM-Generator, so adding this becomes the
main purpose of this fork.
@rdnetto
Copy link
Owner

rdnetto commented Oct 24, 2016

Could you please verify that autocompletion continues to work under Linux with this change? (Docker is an easy way to get a test environment, if you have it setup, otherwise any old live CD should be fine.)

Also, please target this PR at develop, rather than stable.

@leofang
Copy link
Author

leofang commented Oct 24, 2016

@rdnetto OK. Just tested on Ubuntu 14.04.4 with Vim 7.4.882, and everything works. The virtual machine to which I have easy access only has Ubuntu, so if you'd like to see more tests on, for example, Fedora or Debian, it'll have to wait. I'd be very grateful to whoever helps perform tests on these platforms.

Can I simply change the base to develop on this page? Or I need to merge with the latest develop on my fork first, and then resubmit a pull request? Thanks.

ps. I updated the description in this pull request to make it clearer --- see if it eliminates your concerns.

@rdnetto
Copy link
Owner

rdnetto commented Oct 26, 2016

Just tested on Ubuntu 14.04.4 with Vim 7.4.882, and everything works. The virtual machine to which I have easy access only has Ubuntu, so if you'd like to see more tests on, for example, Fedora or Debian, it'll have to wait. I'd be very grateful to whoever helps perform tests on these platforms.

If it works under Ubuntu then it should be fine, assuming Clang hasn't made some breaking change since.

Can I simply change the base to develop on this page? Or I need to merge with the latest develop on my fork first, and then resubmit a pull request? Thanks.

Just change the base on this page - stable lags develop, so you don't need to explicitly merge unless you have conflicts.

@leofang leofang changed the base branch from stable to develop October 26, 2016 15:24
@leofang
Copy link
Author

leofang commented Oct 26, 2016

@rdnetto Good, thanks. Just changed the base. Seems no conflict.

@rdnetto
Copy link
Owner

rdnetto commented Oct 27, 2016

Great, thanks for the PR. :)

@rdnetto rdnetto merged commit 6a7a6b8 into rdnetto:develop Oct 27, 2016
@theFool32
Copy link

-#!/usr/bin/env python2
+#!/usr/bin/env python

It fails when evn python gets python3.
Shouldn't be modified.

@leofang
Copy link
Author

leofang commented Oct 29, 2016

@theFool32 The generator should support both Python 2 and 3, and this change has been made earlier than my pull request; see commit 95b78ba.

Without changing from python2 to python, the generator would throw the following error (on OS X):

[No write since last change]
env: python2: No such file or directory

shell returned 127

@theFool32
Copy link

@leofang I'm sorry to the comment above since I consider your pull request makes the change.
But the generator has not been compatible with py3. For example,
sorted(set([('-isystem', '/usr/include/opencv'), '-std=c++11']))
fails in py3 while works in py2.

@rdnetto
Copy link
Owner

rdnetto commented Oct 30, 2016

@theFool32 Since we now target both Python 2 and 3 (as of #86), any code which isn't compatible with both represents a bug. FWIW, supporting both is unavoidable, because python is the only executable for Python 2 on OSX, but points to Python 3 on Arch Linux (and is user configurable to either on Gentoo).

Please open a separate bug for it and we can figure out how to fix this there.

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

Successfully merging this pull request may close these issues.

4 participants