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

deoplete-clang get errors #59

Open
andrea993 opened this issue Oct 13, 2016 · 23 comments
Open

deoplete-clang get errors #59

andrea993 opened this issue Oct 13, 2016 · 23 comments

Comments

@andrea993
Copy link

andrea993 commented Oct 13, 2016

Deoplete-clang doesn't work I get this error when it should complete the cpp syntax:

[deoplete] Could not get completions from: clang.  Use :messages for error details.   

:messages says:

[deoplete]   File "/home/andrearch/.vim/bundle/deoplete-clang/rplugin/python3/deoplete/sources/deople
te_clang.py", line 151, in gather_candidates                                                         
[deoplete]   File "/home/andrearch/.vim/bundle/deoplete-clang/rplugin/python3/deoplete/sources/deople
[deoplete]   File "/home/andrearch/.vim/bundle/deoplete-clang/rplugin/python3/deoplete/sources/deople
[deoplete]   File "/home/andrearch/.vim/bundle/deoplete-clang/rplugin/python3/deoplete/clang/clang/ci
[deoplete]   File "/home/andrearch/.vim/bundle/deoplete-clang/rplugin/python3/deoplete/clang/clang/ci
"pippo.cpp" 8L, 65C                                                                                  
[deoplete] Traceback (most recent call last):                                                        
[deoplete]   File "/home/andrearch/.vim/bundle/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", l
ine 98, in gather_results                                                                            
[deoplete]     ctx['candidates'] = source.gather_candidates(ctx)                                     
[deoplete]   File "/home/andrearch/.vim/bundle/deoplete-clang/rplugin/python3/deoplete/sources/deople
te_clang.py", line 151, in gather_candidates                                                         
[deoplete]     params)                                                                               
[deoplete]   File "/home/andrearch/.vim/bundle/deoplete-clang/rplugin/python3/deoplete/sources/deople
te_clang.py", line 314, in get_completion                                                            
[deoplete]     tu = self.get_translation_unit(fname, args, buf)                                      
[deoplete]   File "/home/andrearch/.vim/bundle/deoplete-clang/rplugin/python3/deoplete/sources/deople
te_clang.py", line 301, in get_translation_unit                                                      
[deoplete]     tu = self.index.parse(fname, args, buf, flags)                                        
[deoplete]   File "/home/andrearch/.vim/bundle/deoplete-clang/rplugin/python3/deoplete/clang/clang/ci
ndex.py", line 2322, in parse                                                                        
[deoplete]     self)                                                                                 
[deoplete]   File "/home/andrearch/.vim/bundle/deoplete-clang/rplugin/python3/deoplete/clang/clang/ci
ndex.py", line 2440, in from_source                                                                  
[deoplete]     raise TranslationUnitLoadError("Error parsing translation unit.")                     
[deoplete] clang.cindex.TranslationUnitLoadError: Error parsing translation unit.                    
[deoplete] Could not get completions from: clang.  Use :messages for error details.                  
[deoplete] Traceback (most recent call last):                                                        
[deoplete]   File "/home/andrearch/.vim/bundle/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", l
ine 98, in gather_results                                                                            
[deoplete]     ctx['candidates'] = source.gather_candidates(ctx)                                     
[deoplete]   File "/home/andrearch/.vim/bundle/deoplete-clang/rplugin/python3/deoplete/sources/deople
te_clang.py", line 151, in gather_candidates                                                         
[deoplete]     params)                                                                               
[deoplete]   File "/home/andrearch/.vim/bundle/deoplete-clang/rplugin/python3/deoplete/sources/deople
te_clang.py", line 314, in get_completion                                                            
[deoplete]     tu = self.get_translation_unit(fname, args, buf)                                      
[deoplete]   File "/home/andrearch/.vim/bundle/deoplete-clang/rplugin/python3/deoplete/sources/deople
te_clang.py", line 301, in get_translation_unit                                                      
[deoplete]     tu = self.index.parse(fname, args, buf, flags)                                        
[deoplete]   File "/home/andrearch/.vim/bundle/deoplete-clang/rplugin/python3/deoplete/clang/clang/ci
ndex.py", line 2322, in parse                                                                        
[deoplete]     self)                                                                                 
[deoplete]   File "/home/andrearch/.vim/bundle/deoplete-clang/rplugin/python3/deoplete/clang/clang/ci
ndex.py", line 2440, in from_source                                                                  
[deoplete]     raise TranslationUnitLoadError("Error parsing translation unit.")                     
[deoplete] clang.cindex.TranslationUnitLoadError: Error parsing translation unit.                    
[deoplete] Could not get completions from: clang.  Use :messages for error details. 

this is my init.vim
https://arin.ga/pN1SjM

@zchee
Copy link
Member

zchee commented Oct 14, 2016

@andrea993 Thanks issue :)

Hmm.. I have not yet debug, will check it.
Sorry, if you have time, could you post a sample C source at occurring this problem?

@andrea993
Copy link
Author

andrea993 commented Oct 14, 2016

I have this issue with all .cpp files

#include <iostream>

using namespace std;

int main()
{
    std::
}

If. for example. I go at the end of std:: and I press a to write I get the error

@zchee
Copy link
Member

zchee commented Oct 14, 2016

@andrea993 I think your problem same as #54
That's not yet merged, but Could you try it?

@Shougo
Copy link
Collaborator

Shougo commented Nov 30, 2016

@andrea993

  • Please upload the compilation database file.
  • I cannot get your init.vim. Please upload it to another place.

@parnmatt
Copy link

parnmatt commented Dec 4, 2016

Rather than creating another issue, this issue seems to be similar if not the same.

I do not know what the compilation database file is, @Shougo, where would this file be located?

Minimal init.vim

" init.vim

" dein plugin manager
function! InstallPluginManager()
    echom 'Installing dein...'
    silent! call mkdir($XDG_CONFIG_HOME . '/nvim/dein', 'p')
    silent! execute '!curl --fail --location --output /tmp/dein.sh '
             \ . 'https://raw.githubusercontent.com/'
             \ . 'Shougo/dein.vim/master/bin/installer.sh'
    silent! execute '!sh /tmp/dein.sh ' . $XDG_CONFIG_HOME . '/nvim/dein'
endfunction

if !filereadable($XDG_CONFIG_HOME . '/nvim/dein/'
            \ . 'repos/github.com/Shougo/dein.vim/autoload/dein.vim')
    call InstallPluginManager()
endif

set runtimepath+=$XDG_CONFIG_HOME/nvim/dein/repos/github.com/Shougo/dein.vim
call dein#begin($XDG_CONFIG_HOME . '/nvim/dein')
call dein#add('Shougo/dein.vim')
call dein#add('Shougo/deoplete.nvim')
call dein#add('zchee/deoplete-clang')
call dein#end()

if dein#check_install()
    call dein#install()
endif

filetype plugin indent on
syntax enable
call deoplete#enable()
autocmd CompleteDone * pclose

The test file I used was:

// test.cc

#include <vector>

std

As typing the d in std the following errors were printed to :messages

[deoplete] Traceback (most recent call last):
[deoplete]   File "/home/parnmatt/.dotfiles/nvim/.config/nvim/dein/.cache/init.vim/.dein/rplugin/python3/deoplete/deoplete.py", line 100, in gather_results
[deoplete]     ctx['candidates'] = source.gather_candidates(ctx)
[deoplete]   File "/home/parnmatt/.config/nvim/dein/.cache/init.vim/.dein/rplugin/python3/deoplete/sources/deoplete_clang.py", line 151, in gather_candidates
[deoplete]     params)
[deoplete]   File "/home/parnmatt/.config/nvim/dein/.cache/init.vim/.dein/rplugin/python3/deoplete/sources/deoplete_clang.py", line 314, in get_completion
[deoplete]     tu = self.get_translation_unit(fname, args, buf)
[deoplete]   File "/home/parnmatt/.config/nvim/dein/.cache/init.vim/.dein/rplugin/python3/deoplete/sources/deoplete_clang.py", line 301, in get_translation_unit
[deoplete]     tu = self.index.parse(fname, args, buf, flags)
[deoplete]   File "/home/parnmatt/.config/nvim/dein/.cache/init.vim/.dein/rplugin/python3/deoplete/clang/clang/cindex.py", line 2322, in parse
[deoplete]     self)
[deoplete]   File "/home/parnmatt/.config/nvim/dein/.cache/init.vim/.dein/rplugin/python3/deoplete/clang/clang/cindex.py", line 2440, in from_source
[deoplete]     raise TranslationUnitLoadError("Error parsing translation unit.")
[deoplete] clang.cindex.TranslationUnitLoadError: Error parsing translation unit.
[deoplete] Could not get completions from: clang.  Use :messages for error details.

@Shougo
Copy link
Collaborator

Shougo commented Dec 4, 2016

I do not know what the compilation database file is, @Shougo, where would this file be located?

Hm. It is not specified.
We should improve the error message.
But where is your libclang installed?
I think you need to set it like this.

let g:deoplete#sources#clang#libclang_path = '/usr/lib/libclang.so'

@parnmatt
Copy link

parnmatt commented Dec 4, 2016

Indeed, libclang is located, and symlinked to /usr/lib/libclang.so -> libclang.so.3.9.

This is a standard place for the library to be located, and certainly should be in the library path.
Why wouldn't this be found by neovim / deoplete-clang?

I will try the minimal configuration with the path hardcoded as suggested and get back to you.

@Shougo
Copy link
Collaborator

Shougo commented Dec 4, 2016

This is a standard place for the library to be located, and certainly should be in the library path.
Why wouldn't this be found by neovim / deoplete-clang?

Unfortunately, it is not standard.
This is for Ubuntu 16.04 configuration.

let g:deoplete#sources#clang#libclang_path = '/usr/lib/llvm-3.8/lib/libclang-3.8.so'

@parnmatt
Copy link

parnmatt commented Dec 7, 2016

Yep correcting this has solved my issue.
I correctly pointed libclang_path and clang_header to the correct paths.

However the moment I start typing #include it freezes (I assume looking for headers to complete; and uses ) for 5-10; and does so whenever I edit on that line.

@Shougo
Copy link
Collaborator

Shougo commented Dec 7, 2016

Yes, deoplete-clang has many performance problems.
But it will be fixed by @zchee .

@Cypher1
Copy link

Cypher1 commented Dec 9, 2016

I'm also having a similar problem, can we just get deoplete-clang to ignore lines that start with '#'?

(or have an option for that)

@kierun
Copy link

kierun commented Dec 19, 2016

I have the same issue (I think?) but setting libclang_path and clang_header did not solve it. The really weird thing is that after the error, completion works just fine.

Is there something I can try to provide you with more debug information?

@sshtmc
Copy link

sshtmc commented Mar 6, 2017

I have the same problem. Any update on the issue?

@Shougo
Copy link
Collaborator

Shougo commented Mar 8, 2017

You should use deoplete-clang2 instead.

https://github.com/tweekmonster/deoplete-clang2

@Cypher1
Copy link

Cypher1 commented Mar 8, 2017

Why is there a second deoplete rather than a second version?

@Shougo
Copy link
Collaborator

Shougo commented Mar 8, 2017

Because, @zchee implements the new version of deoplete-clang.
He is very busy. No time to fix the bugs in deoplete-clang currently.

@Cypher1
Copy link

Cypher1 commented Mar 9, 2017

Hmm, fair enough, couldn't we just have branches to facilitate visibility and merging?

Deoplete is an awesome plugin, I'd hate to see two parts diverge and end up with incompatible features.

@sshtmc
Copy link

sshtmc commented Mar 9, 2017

@Cypher1 I think there's a misunderstanding (from the eyes of a complete outsider). Deoplete is a separate project from deoplete-clang. Deoplete stays as is. However, deoplete-clang had too high code complexity (it seems) and now there's going to be deoplete-clang2.

But regardless of the above, I would also like to see deoplete-clang2 replace deoplete-clang (become version 2). IMHO there's no point in having deoplete-clang if it's full of bugs and nobody is maintaining it.

@kierun
Copy link

kierun commented Mar 9, 2017

This is going to add to the confusions of users unless someone actually write this on the main README…

@sshtmc
Copy link

sshtmc commented Mar 9, 2017

I just tried deoplete-clang2 (https://github.com/tweekmonster/deoplete-clang2) and it worked great, without any issues.

@Shougo
Copy link
Collaborator

Shougo commented Mar 12, 2017

@Cypher1 I think there's a misunderstanding (from the eyes of a complete outsider). Deoplete is a separate project from deoplete-clang. Deoplete stays as is. However, deoplete-clang had too high code complexity (it seems) and now there's going to be deoplete-clang2.

Yes.

But regardless of the above, I would also like to see deoplete-clang2 replace deoplete-clang (become version 2). IMHO there's no point in having deoplete-clang if it's full of bugs and nobody is maintaining it.

I like deoplete-clang than deoplete-clang2.
deoplete-clang will be rewritten.

@AnisPeysieux
Copy link

Hi!
I have the same problem. My PC is on Debian testing.
My libclang is at /usr/lib/llvm-3.8/lib/libclang.so.
I tried deoplete-clang2 but I get errors too, even if I write let g:deoplete#sources#clang#executable='/usr/bin/clang', let g:deoplete#sources#clang#executable='/usr/bin/clang2' or let g:deoplete#sources#clang#executable='/usr/bin/clang-3.8'.

Have you an idea?

Thanks.

@Shougo
Copy link
Collaborator

Shougo commented Apr 9, 2017

I tried deoplete-clang2 but I get errors too, even if I write let

You should create new issue in deoplete-clang2.

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

No branches or pull requests

8 participants