YouCompleteMe icon indicating copy to clipboard operation
YouCompleteMe copied to clipboard

clang completer does not complete anything C related

Open Antoine948398 opened this issue 7 years ago • 4 comments

Issue Prelude

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

  • [x] I have read and understood YCM's [CONTRIBUTING][cont] document.
  • [x] I have read and understood YCM's [CODE_OF_CONDUCT][code] document.
  • [x] I have read and understood YCM's [README][readme], especially the [Frequently Asked Questions][faq] section.
  • [x] 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.][search])
  • [x] If filing a bug report, I have included the output of vim --version.
  • [x] If filing a bug report, I have included the output of :YcmDebugInfo.
  • [x] If filing a bug report, I have attached the contents of the logfiles using the :YcmToggleLogs command.
  • [x] 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
  • [x] 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.
  • [x] 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

  • What did you do?

I installed vim on my distribution (Solus Linux), and try to install YCM using vim-plug.

  • What did you expect to happen?

I am using YCM on other computers and I expect the same behavior ( completion of the method names, directly show compilation errors / warning etc..)

  • What actually happened?

Some auto completions are working (like file path), but none C related (like accessing to the methods of an object, compiler errors etc.).

I also have this message :

Maximum Number of diagnostics exceeded

I use compile_commands.json generated by CMake for my C/C++ projects, like I am used to do on my other machines

Diagnostic data

Output of vim --version

VIM - Vi IMproved 8.1 (2018 May 18, compiled May 31 2019 15:22:35)
Included patches: 1-1432
Modified by Solus
Compiled by Solus
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl               +extra_search      +mouse_netterm     -tag_old_static
+arabic            -farsi             +mouse_sgr         -tag_any_white
+autocmd           +file_in_path      -mouse_sysmouse    -tcl
+autochdir         +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
+balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
+browse            +fork()            -mzscheme          +textobjects
++builtin_terms    +gettext           -netbeans_intg     +textprop
+byte_offset       -hangul_input      +num64             +timers
+channel           +iconv             +packages          +title
+cindent           +insert_expand     +path_extra        +toolbar
+clientserver      +job               -perl              +user_commands
+clipboard         +jumplist          +persistent_undo   +vartabs
+cmdline_compl     +keymap            +postscript        +vertsplit
+cmdline_hist      +lambda            +printer           +virtualedit
+cmdline_info      +langmap           +profile           +visual
+comments          +libcall           +python/dyn        +visualextra
+conceal           +linebreak         +python3/dyn       +viminfo
+cryptv            +lispindent        +quickfix          +vreplace
+cscope            +listcmds          +reltime           +wildignore
+cursorbind        +localmap          +rightleft         +wildmenu
+cursorshape       +lua               +ruby              +windows
+dialog_con_gui    +menu              +scrollbind        +writebackup
+diff              +mksession         +signs             +X11
+digraphs          +modify_fname      +smartindent       -xfontset
+dnd               +mouse             +startuptime       +xim
-ebcdic            +mouseshape        +statusline        +xpm
+emacs_tags        +mouse_dec         -sun_workshop      +xsmp_interact
+eval              +mouse_gpm         +syntax            +xterm_clipboard
+ex_extra          -mouse_jsbterm     +tag_binary        -xterm_save
   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: "/usr/share/vim"
Compilation: x86_64-solus-linux-gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/libdrm -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/uuid -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include   -mtune=generic -march=x86-64 -g2 -O2 -pipe -fPIC -Wformat -Wformat-security -fstack-protector-strong --param ssp-buffer-size=32 -fasynchronous-unwind-tables -ftree-vectorize -feliminate-unused-debug-types -Wall -Wno-error -Wp,-D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: x86_64-solus-linux-gcc   -L. -Wl,--copy-dt-needed-entries -Wl,-O1 -Wl,-z,relro -Wl,-z,now -Wl,-z,max-page-size=0x1000 -Wl,-Bsymbolic-functions -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--copy-dt-needed-entries -Wl,-O1 -Wl,-z,relro -Wl,-z,now -Wl,-z,max-page-size=0x1000 -Wl,-Bsymbolic-functions -Wl,--sort-common -Wl,--as-needed -o vim   -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm -lncurses    -lgpm -ldl  -L/usr/lib -llua     -lruby -lm   

Output of YcmDebugInfo

Printing YouCompleteMe debug information...
-- Client logfile: /tmp/ycm_0z2w51q1.log
-- Server Python interpreter: /usr/bin/python3
-- Server Python version: 3.6.8
-- Server has Clang support compiled in: True
-- Clang version: clang version 8.0.0 (tags/RELEASE_800/final)
-- No extra configuration file found
-- C-family completer debug information:
--   Compilation database path: /home/amazuyer/devel/PAMELA
--   Flags: ['/usr/bin/c++', '-x', 'c++', '-DWITH_METIS', '-DWITH_MPI', '-I/home/amazuyer/devel/PAMELA/PA
MELA', '-I/home/amazuyer/devel/PAMELA/PAMELA/source', '-Wall', '-Wextra', '-g', '-fPIC', '-DWITH_MPI', '-
DWITH_METIS', '-std=c++14', '-resource-dir=/home/amazuyer/.vim/plugged/YouCompleteMe/third_party/ycmd/thi
rd_party/clang/lib/clang/8.0.0', '-fspell-checking']
--   Translation unit: /home/amazuyer/devel/PAMELA/PAMELA/source/Mesh/Mesh.cpp
-- Server running at: http://127.0.0.1:45521
-- Server process ID: 28023
-- Server logfiles:
--   /tmp/ycmd_45521_stdout_7v070s_5.log
--   /tmp/ycmd_45521_stderr_etam4zh2.log

Contents of YCM, ycmd and completion engine logfiles

stderr : https://gist.github.com/AntoineMazuyer/121f25ccd17a081d659785724739fb4a
stdout : one line : serving on http://localhost:40643

OS version, distribution, etc.

Kernel: 5.0.16-116.current OS: Solus x86_64

Output of build/install commands

Compile logs https://gist.github.com/AntoineMazuyer/e9f610f71755aecc454827407b8bd9c6

Antoine948398 avatar Jun 07 '19 03:06 Antoine948398

Maximum Number of diagnostics exceeded

This would be why. There are loads of compile errors. Check YcmDiags and fix the errors (likely your compile flags).

puremourning avatar Jun 07 '19 07:06 puremourning

@puremourning thanks for the answer.

Indeed I have a lot of errors like :

'vector' file not found
 'cmath' file not found
use of undeclared identifier 'std'

Antoine948398 avatar Jun 07 '19 16:06 Antoine948398

right, well lib clang clearly isn't able to find your standard library headers. I think fixing the flags will resolve this.

puremourning avatar Jun 07 '19 16:06 puremourning

Thanks, I have solved this using the option --system-libclang while installing

Antoine948398 avatar Jun 07 '19 16:06 Antoine948398