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

TranslationUnitLoadError #68

Open
covercash2 opened this issue Dec 14, 2016 · 6 comments
Open

TranslationUnitLoadError #68

covercash2 opened this issue Dec 14, 2016 · 6 comments

Comments

@covercash2
Copy link

covercash2 commented Dec 14, 2016

Problems summary

just trying to get autocomplete with neovim.

from neovim :messages : http://pastebin.com/d48cuBTR

this is very similar to #59, but that seems to be solved with setting the right clang paths, which I think I have set correctly in my init.vim (this is minimal, but confirmed): http://pastebin.com/MPHVLRD1

I've installed llvm/clang with homebrew and had the same problem, but my current llvm I compiled into my home tree.

I get the same behavior as #59 where I type std and deoplete-clang goes nuts. also happens with sf (SFML).

Expected

autocomplete

Environment Information

  • OS: macOS 10.11.6
  • Neovim version: 0.1.7

reproduce

  1. install neovim
  2. run my init.vim using plug, deoplete, and deoplete-clang, also setting libclang and clang headers path
  3. try to write c/c++
  4. chain smoke and cry

logfile

I generated this logfile: http://pastebin.com/dakv1Seu

Screen shot

nvim fucking up.jpg

conclusion

let me know if you need anything else or about any work-arounds

@ghost
Copy link

ghost commented Jan 2, 2017

I have the same problem.

@mikoim
Copy link

mikoim commented Jun 2, 2017

@covercash2 @stjepang You should read README.md carefully. g:deoplete#sources#clang#libclang_path and g:deoplete#sources#clang#clang_header are needed to work this plugin.

sry 😢

example (tested with Arch Linux)

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

@covercash2
Copy link
Author

here's the same init file i originally posted. also, this issue was only on macOS.

i tried to be thorough in my original report.

@Shougo
Copy link
Collaborator

Shougo commented Jun 2, 2017

I think it depends clang version.
Using deoplete-clang2 is recommended.

@wsdjeg
Copy link

wsdjeg commented Dec 3, 2017

I get same errors:


[deoplete] Traceback (most recent call last):
[deoplete]   File "/home/wsdjeg/.cache/vimfiles/repos/github.com/Shougo/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 136, in gather_results
[deoplete]     ctx['candidates'] = source.gather_candidates(ctx)
[deoplete]   File "/home/wsdjeg/.cache/vimfiles/.cache/init.vim/.dein/rplugin/python3/deoplete/sources/deoplete_clang.py", line 151, in gather_candidates
[deoplete]     params)
[deoplete]   File "/home/wsdjeg/.cache/vimfiles/.cache/init.vim/.dein/rplugin/python3/deoplete/sources/deoplete_clang.py", line 318, in get_completion
[deoplete]     tu = self.get_translation_unit(fname, args, buf)
[deoplete]   File "/home/wsdjeg/.cache/vimfiles/.cache/init.vim/.dein/rplugin/python3/deoplete/sources/deoplete_clang.py", line 305, in get_translation_unit
[deoplete]     tu = self.index.parse(fname, args, buf, flags)
[deoplete]   File "/home/wsdjeg/.cache/vimfiles/.cache/init.vim/.dein/rplugin/python3/deoplete/clang/clang/cindex.py", line 2322, in parse
[deoplete]     self)
[deoplete]   File "/home/wsdjeg/.cache/vimfiles/.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.
[deoplete] Traceback (most recent call last):
[deoplete]   File "/home/wsdjeg/.cache/vimfiles/repos/github.com/Shougo/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 136, in gather_results
[deoplete]     ctx['candidates'] = source.gather_candidates(ctx)
[deoplete]   File "/home/wsdjeg/.cache/vimfiles/.cache/init.vim/.dein/rplugin/python3/deoplete/sources/deoplete_clang.py", line 151, in gather_candidates
[deoplete]     params)
[deoplete]   File "/home/wsdjeg/.cache/vimfiles/.cache/init.vim/.dein/rplugin/python3/deoplete/sources/deoplete_clang.py", line 318, in get_completion
[deoplete]     tu = self.get_translation_unit(fname, args, buf)
[deoplete] Too many errors from "clang". This source is disabled until Neovim is restarted.
[deoplete]   File "/home/wsdjeg/.cache/vimfiles/.cache/init.vim/.dein/rplugin/python3/deoplete/sources/deoplete_clang.py", line 305, in get_translation_unit
[deoplete] Too many errors from "clang". This source is disabled until Neovim is restarted.
[deoplete]     tu = self.index.parse(fname, args, buf, flags)
[deoplete] Traceback (most recent call last):
[deoplete]   File "/home/wsdjeg/.cache/vimfiles/.cache/init.vim/.dein/rplugin/python3/deoplete/clang/clang/cindex.py", line 2322, in parse
[deoplete]   File "/home/wsdjeg/.cache/vimfiles/repos/github.com/Shougo/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 136, in gather_results
[deoplete]     self)
[deoplete]     ctx['candidates'] = source.gather_candidates(ctx)
[deoplete]   File "/home/wsdjeg/.cache/vimfiles/.cache/init.vim/.dein/rplugin/python3/deoplete/clang/clang/cindex.py", line 2440, in from_source
[deoplete]   File "/home/wsdjeg/.cache/vimfiles/.cache/init.vim/.dein/rplugin/python3/deoplete/sources/deoplete_clang.py", line 151, in gather_candidates
[deoplete]     raise TranslationUnitLoadError("Error parsing translation unit.")
[deoplete]     params)
[deoplete] clang.cindex.TranslationUnitLoadError: Error parsing translation unit.
[deoplete]   File "/home/wsdjeg/.cache/vimfiles/.cache/init.vim/.dein/rplugin/python3/deoplete/sources/deoplete_clang.py", line 318, in get_completion
[deoplete] Could not get completions from: clang.  Use :messages for error details.
[deoplete]     tu = self.get_translation_unit(fname, args, buf)
[deoplete]   File "/home/wsdjeg/.cache/vimfiles/.cache/init.vim/.dein/rplugin/python3/deoplete/sources/deoplete_clang.py", line 305, in get_translation_unit
[deoplete]     tu = self.index.parse(fname, args, buf, flags)
[deoplete]   File "/home/wsdjeg/.cache/vimfiles/.cache/init.vim/.dein/rplugin/python3/deoplete/clang/clang/cindex.py", line 2322, in parse
[deoplete]     self)
[deoplete]   File "/home/wsdjeg/.cache/vimfiles/.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] 
[deoplete] During handling of the above exception, another exception occurred:
[deoplete] 
[deoplete] Traceback (most recent call last):
[deoplete]   File "/home/wsdjeg/.cache/vimfiles/repos/github.com/Shougo/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 59, in completion_begin
[deoplete]     self.gather_results(context), context['input'])
[deoplete]   File "/home/wsdjeg/.cache/vimfiles/repos/github.com/Shougo/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 162, in gather_results
[deoplete]     self._sources.pop(source.name)
[deoplete] KeyError: 'clang'
[deoplete] Error while gathering completions.  Use :messages for error details.

@hwalinga
Copy link

Sometimes it was just a matter of removing the translation unit file again. (The .tu file) And it all works again.

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

5 participants