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

doesn't work for cstdio #2790

Closed
12 tasks done
wenxingxing opened this issue Sep 26, 2017 · 1 comment · Fixed by ycm-core/ycmd#855
Closed
12 tasks done

doesn't work for cstdio #2790

wenxingxing opened this issue Sep 26, 2017 · 1 comment · Fixed by ycm-core/ycmd#855

Comments

@wenxingxing
Copy link

Issue Prelude

Please complete these steps and check these boxes (by putting an x inside
the brackets) before filing your issue:

  • I have read and understood YCM's CONTRIBUTING document.
  • I have read and understood YCM's CODE_OF_CONDUCT document.
  • I have read and understood YCM's README, especially the
    Frequently Asked Questions section.
  • I have searched YCM's issue tracker to find issues similar to the one I'm
    about to report and couldn't find an answer to my problem. (Example Google
    search.
    )
  • If filing a bug report, I have included the output of vim --version.
  • If filing a bug report, I have included the output of :YcmDebugInfo.
  • If filing a bug report, I have attached the contents of the logfiles using
    the :YcmToggleLogs command.
  • If filing a bug report, I have included which OS (including specific OS
    version) I am using.
  • If filing a bug report, I have included a minimal test case that reproduces
    my issue, including what I expected to happen and what actually happened.
  • If filing a installation failure report, I have included the entire output
    of install.py (or cmake/make/ninja) including its invocation
  • I understand this is an open-source project staffed by volunteers and
    that any help I receive is a selfless, heartfelt gift of their free time. I
    know I am not entitled to anything and will be polite and courteous.
  • I understand my issue may be closed if it becomes obvious I didn't
    actually perform all of these steps.

Thank you for adhering to this process! It ensures your issue is resolved
quickly and that neither your nor our time is needlessly wasted.

Issue Details

Provide a clear description of the problem, including the following key
questions: YCM report error on every function in <stdio.h>, but works for other STL libs ...

  • What actually happened?
    screenshot

Diagnostic data

Output of vim --version

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Sep 13 2017 04:07:30)
MacOS X (unix) version
Included patches: 1-1098
Compiled by [email protected]
Huge version with MacVim GUI. Features included (+) or not (-):
+acl +find_in_path -mouse_sysmouse -tag_any_white
+arabic +float +mouse_urxvt -tcl
+autocmd +folding +mouse_xterm +termguicolors
+balloon_eval -footer +multi_byte +terminal
+browse +fork() +multi_lang +terminfo
++builtin_terms +fullscreen -mzscheme +termresponse
+byte_offset -gettext +netbeans_intg +textobjects
+channel -hangul_input +num64 +timers
+cindent +iconv +odbeditor +title
+clientserver +insert_expand +packages +toolbar
+clipboard +job +path_extra +transparency
+cmdline_compl +jumplist +perl/dyn +user_commands
+cmdline_hist +keymap +persistent_undo +vertsplit
+cmdline_info +lambda +postscript +virtualedit
+comments +langmap +printer +visual
+conceal +libcall +profile +visualextra
+cryptv +linebreak +python/dyn +viminfo
+cscope +lispindent +python3/dyn +vreplace
+cursorbind +listcmds +quickfix +wildignore
+cursorshape +localmap +reltime +wildmenu
+dialog_con_gui +lua/dyn +rightleft +windows
+diff +menu +ruby/dyn +writebackup
+digraphs +mksession +scrollbind -X11
+dnd +modify_fname +signs -xfontset
-ebcdic +mouse +smartindent +xim
+emacs_tags +mouseshape +startuptime -xpm
+eval +mouse_dec +statusline -xsmp
+ex_extra -mouse_gpm -sun_workshop -xterm_clipboard
+extra_search -mouse_jsbterm +syntax -xterm_save
+farsi +mouse_netterm +tag_binary
+file_in_path +mouse_sgr +tag_old_static
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "/.vim/vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "
/.vim/gvimrc"
defaults file: "$VIMRUNTIME/defaults.vim"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe -DMACOS_X_UNIX -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang -L. -fstack-protector -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -L. -fstack-protector -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon -lm -lncurses -liconv -framework Cocoa -fstack-protector -L/System/Library/Perl/5.16/darwin-thread-multi-2level/CORE

Include link here to a gist containing the entire logfiles for ycm, ycmd
and any completer logfiles listed by :YcmToggleLogs.

OS version, distribution, etc.

Darwin mwx.lan 17.0.0 Darwin Kernel Version 17.0.0: Thu Aug 24 21:48:19 PDT 2017; root:xnu-4570.1.46~2/RELEASE_X86_64 x86_64

Output of build/install commands

-- The C compiler identification is AppleClang 9.0.0.9000037
-- The CXX compiler identification is AppleClang 9.0.0.9000037
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonLibs: /usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib (found suitable version "2.7.14", minimum required is "2.6")
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- filesystem
-- regex
-- system
-- python
-- Configuring done
-- Generating done
-- Build files have been written to: /private/var/folders/pw/yg2352tj7cj_20pz3sb83r500000gn/T/ycm_build_Yx6GJN
Scanning dependencies of target ycm_core
[ 9%] Building CXX object ycm/CMakeFiles/ycm_core.dir/CandidateRepository.cpp.o
[ 9%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Candidate.cpp.o
[ 18%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/Documentation.cpp.o
[ 22%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/CompletionData.cpp.o
[ 27%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/ClangHelpers.cpp.o
[ 31%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/ClangUtils.cpp.o
[ 31%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/ClangCompleter.cpp.o
[ 36%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/CompilationDatabase.cpp.o
[ 40%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/Range.cpp.o
[ 45%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/TranslationUnit.cpp.o
[ 50%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/TranslationUnitStore.cpp.o
[ 54%] Building CXX object ycm/CMakeFiles/ycm_core.dir/IdentifierCompleter.cpp.o
[ 59%] Building CXX object ycm/CMakeFiles/ycm_core.dir/IdentifierDatabase.cpp.o
[ 63%] Building CXX object ycm/CMakeFiles/ycm_core.dir/IdentifierUtils.cpp.o
[ 68%] Building CXX object ycm/CMakeFiles/ycm_core.dir/LetterNode.cpp.o
[ 72%] Building CXX object ycm/CMakeFiles/ycm_core.dir/LetterNodeListMap.cpp.o
[ 77%] Building CXX object ycm/CMakeFiles/ycm_core.dir/PythonSupport.cpp.o
[ 81%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Result.cpp.o
[ 86%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Utils.cpp.o
[ 90%] Building CXX object ycm/CMakeFiles/ycm_core.dir/versioning.cpp.o
[ 95%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ycm_core.cpp.o
[100%] Linking CXX shared library /Users/mwx/.vim/plugged/YouCompleteMe/third_party/ycmd/ycm_core.so
[100%] Built target ycm_core
Searching Python 2.7 libraries...
Found Python library: /usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib
Found Python headers folder: /usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/include/python2.7

Include link to a gist containing the invocation and entire output of
install.py if reporting an installation issue.

@mellery451
Copy link

I'm having a very similar issue - in my case for different set of standard headers, but nonetheless:

/usr/include/netinet/in.h|532 col 2 error| unknown type name 'uint32_t'
/usr/include/netinet/in.h|537 col 2 error| unknown type name 'uint32_t'
/usr/include/netinet/in.h|550 col 2 error| unknown type name 'uint32_t'
/usr/include/netinet/in.h|551 col 2 error| unknown type name 'uint32_t'
/usr/include/netinet/in.h|552 col 2 error| unknown type name 'uint32_t'
/usr/include/netinet/in.h|553 col 2 error| unknown type name 'uint32_t'
/usr/include/netinet/in.h|568 col 62 error| C++ requires a type specifier for all declarations
/usr/include/netinet/in.h|569 col 6 error| C++ requires a type specifier for all declarations
/usr/include/netinet/in.h|569 col 6 error| redefinition of parameter 'uint32_t'
/usr/include/netinet/in.h|570 col 62 error| unknown type name 'uint32_t'
/usr/include/netinet/in.h|571 col 6 error| unknown type name 'uint32_t'
/usr/include/netinet/in.h|572 col 26 error| C++ requires a type specifier for all declarations
/usr/include/netinet/in.h|573 col 6 error| C++ requires a type specifier for all declarations
/usr/include/netinet/in.h|573 col 6 error| redefinition of parameter 'uint32_t'
/usr/include/netinet/in.h|573 col 16 error| C++ requires a type specifier for all declarations
/usr/include/netinet/in.h|573 col 16 error| redefinition of parameter 'uint32_t'
/usr/include/netinet/in.h|574 col 26 error| C++ requires a type specifier for all declarations
/usr/include/netinet/in.h|575 col 6 error| unknown type name 'uint32_t'
/usr/include/netinet/in.h|575 col 18 error| unknown type name 'uint32_t'
get_my_ip/get_ip.cpp|30 col 5 error| use of undeclared identifier 'memset'
get_my_ip/get_ip.cpp|36 col 19 error| invalid operands to binary expression ('std::__1::ostream' (aka 'int') and 'const char *')
get_my_ip/get_ip.cpp|41 col 15 error| invalid operands to binary expression ('std::__1::ostream' (aka 'int') and 'const char *')
get_my_ip/get_ip.cpp|54 col 19 error| invalid operands to binary expression ('std::__1::ostream' (aka 'int') and 'const char *')
get_my_ip/get_ip.cpp|60 col 15 error| invalid operands to binary expression ('std::__1::ostream' (aka 'int') and 'const char *')
get_my_ip/get_ip.cpp|63 col 19 error| invalid operands to binary expression ('std::__1::ostream' (aka 'int') and 'const char *')
get_my_ip/get_ip.cpp|63 col 56 error| use of undeclared identifier 'errno'
get_my_ip/get_ip.cpp|86 col 27 error| invalid operands to binary expression ('std::__1::ostream' (aka 'int') and 'const char *')
get_my_ip/get_ip.cpp|91 col 27 error| invalid operands to binary expression ('std::__1::ostream' (aka 'int') and 'const char *')
get_my_ip/get_ip.cpp|94 col 27 error| invalid operands to binary expression ('std::__1::ostream' (aka 'int') and 'const char *')
get_my_ip/get_ip.cpp|94 col 63 error| use of undeclared identifier 'errno'

I believe the thing that changed is Xcode..it recently updated to apple clang 9.0.0 (notice the ycmd build output above). I've been a long time user of YCM and I've just started having these issues after XCode updated recently.

Any suggestions about what to try to resolve this? Are there known issues with YCM on systems with the latest version of XCode?

zzbot added a commit to ycm-core/ycmd that referenced this issue Oct 8, 2017
[READY] Only include one of the possible mac toolchains in the include paths

This is the yearly update to fix the latest macOS incompatibilities.

It seems with Xcode 9 (for reasons I really don't understand), having both the Xcode "command line tools" _and_ Xcode in your include paths leads to errors being raised in standard headers.

This change simply only adds a single set of system headers from a single toolchain on macOS.

Fixes ycm-core/YouCompleteMe#2790
Fixes #844
Fixes ycm-core/YouCompleteMe#2536

This is a quicker and probably less contentious solution than #853

This is sort of equivalent to #854, but the implementation is simpler and has working tests.

# Testing

Repro steps:

* with both Xcode and CLT installed create a trivial .ycm_extra_conf.py (flags -x c++ -Wall)
* create a trivial c++ file and `#include <sys/types.h>` and some other c++ headers.
* `:YcmDiags`

I've tested this:

* with both Xcode and CLT
* with just Xcode
* with just CLT

All work.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/ycmd/855)
<!-- Reviewable:end -->
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 20, 2021
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 a pull request may close this issue.

2 participants