xavierd / clang_complete

Vim plugin that use clang for completing C/C++ code.
http://www.vim.org/scripts/script.php?script_id=3302
1.96k stars 308 forks source link

libclang can not find the builtin includes #554

Open NukeBird opened 6 years ago

NukeBird commented 6 years ago

Hello! I have an warning every time I'm trying to open cpp files:

"cpp17_deduction.cpp" 8L, 121C
WARNING: libclang can not find the builtin includes.
         This will cause slow code completion.
         Please report the problem.

I'm using ubuntu in windows 10 via WSL. Clang was installed in this manner:

wget http://releases.llvm.org/6.0.0/clang+llvm-6.0.0-x86_6..
tar xz clang+llvm-6.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
sudo mv clang+llvm-6.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz /usr/local/clang_6.0.0

(in .bashrc):

export PATH="/usr/local/clang_6.0.0/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/clang_6.0.0/lib:LD_LIBRARY_PATH"

and then I installed clang_complete (vim was already installed):

git clone https://github.com/Rip-Rip/clang_complete
cd clang_complete 
make install
guntisl commented 6 years ago

+1

tibco-ranjan commented 5 years ago

solution:

I solve this issue by following below steps. (CentOS -7)

Install clang-complete from rip-rip. https://github.com/Rip-Rip/clang_complete

Done following entries in ~/.vimrc " path to directory where library can be found let g:clang_library_path='/usr/lib/clang-private/' let g:clang_user_options='|| exit 0' let g:clang_complete_auto = 1 let g:clang_complete_copen = 1 let g:clang_debug = 1

After installation, I got the clang-complete library in the folder "/usr/lib/clang-private/" root@localhost:~/.vim/plugin# ls -lrt /usr/lib/clang-private/ total 34336 -rwxr-xr-x. 1 root root 2846788 Apr 11 2018 libclangStaticAnalyzerCheckers.so.5.0.0 -rwxr-xr-x. 1 root root 930224 Apr 11 2018 libclangParse.so.5.0.0 -rwxr-xr-x. 1 root root 621252 Apr 11 2018 libclangToolingRefactor.so.5.0.0 -rwxr-xr-x. 1 root root 69024 Apr 11 2018 libclangToolingCore.so.5.0.0 -rwxr-xr-x. 1 root root 1334448 Apr 11 2018 libclangStaticAnalyzerCore.so.5.0.0 -rwxr-xr-x. 1 root root 530736 Apr 11 2018 libclang.so.5.0 -rwxr-xr-x. 1 root root 1675192 Apr 11 2018 libclangSerialization.so.5.0.0 -rwxr-xr-x. 1 root root 7506328 Apr 11 2018 libclangSema.so.5.0.0 -rwxr-xr-x. 1 root root 64508 Apr 11 2018 libclangRewrite.so.5.0.0 -rwxr-xr-x. 1 root root 305496 Apr 11 2018 libclangIndex.so.5.0.0 -rwxr-xr-x. 1 root root 22896 Apr 11 2018 libclangFrontendTool.so.5.0.0 -rwxr-xr-x. 1 root root 65064 Apr 11 2018 libclangEdit.so.5.0.0 -rwxr-xr-x. 1 root root 2194228 Apr 11 2018 libclangARCMigrate.so.5.0.0 -rwxr-xr-x. 1 root root 214440 Apr 11 2018 libclangStaticAnalyzerFrontend.so.5.0.0 -rwxr-xr-x. 1 root root 490744 Apr 11 2018 libclangRewriteFrontend.so.5.0.0 -rwxr-xr-x. 1 root root 752560 Apr 11 2018 libclangLex.so.5.0.0 -rwxr-xr-x. 1 root root 1227244 Apr 11 2018 libclangFrontend.so.5.0.0 -rwxr-xr-x. 1 root root 1436748 Apr 11 2018 libclangDynamicASTMatchers.so.5.0.0 -rwxr-xr-x. 1 root root 1405400 Apr 11 2018 libclangDriver.so.5.0.0 -rwxr-xr-x. 1 root root 4083752 Apr 11 2018 libclangCodeGen.so.5.0.0 -rwxr-xr-x. 1 root root 2001524 Apr 11 2018 libclangBasic.so.5.0.0 -rwxr-xr-x. 1 root root 3416144 Apr 11 2018 libclangAST.so.5.0.0 -rwxr-xr-x. 1 root root 343120 Apr 11 2018 libclangTooling.so.5.0.0 -rwxr-xr-x. 1 root root 505440 Apr 11 2018 libclangFormat.so.5.0.0 -rwxr-xr-x. 1 root root 440388 Apr 11 2018 libclangASTMatchers.so.5.0.0 -rwxr-xr-x. 1 root root 629208 Apr 11 2018 libclangAnalysis.so.5.0.0

I didn't getany llvm library, as I had no clang installed on my system.

Installed clang yum install -y clang.

Added the llvm and clang-private lib path in the "libclang.py" script as shown below.

root@localhost:~/.vim/plugin# ls clang clang_complete.vim kinds.py kinds.pyc libclang.py snippets

knownPaths = [ library_path + "/../lib/clang", # default value library_path + "/../clang", # gentoo library_path + "/clang", # opensuse library_path + "/", # Google "/usr/lib64/clang", # x86_64 (openSUSE, Fedora) "/usr/lib/clang" , "/usr/lib/clang-private" , "/usr/lib/llvm" ]

Open any cpp file, the warning message didn't appread "WARNING: libclang can not find the builtin includes." [GONE ha ha ha.............]

include

include

using namespace std;

int main() { std::vector vec; vec. at f std::vector<int, std::allocator >::reference at(std::vector::size_type n) } reserve f void reserve(std::vector::size_type __n) ~ erase f std::vector<int, std::allocator >::iterator erase(std::vector<int, std::allocator >::iter ~ erase f std::vector<int, std::allocator >::iterator erase(std::vector<int, std::allocator >::iter ~ operator[] f std::vector<int, std::allocator >::reference operator[](std::vector::size_type n) ~ insert f std::vector<int, std::allocator >::iterator insert(std::vector<int, std::allocator >::ite ~ insert f void insert(std::vector<int, std::allocator >::iterator position, std::vector::size_type __n ~ pop_back f void pop_back() ~ push_back f void push_back(const std::vector<int, std::allocator >::value_type &x) ~ data f std::vector<int, std::allocator >::pointer data() ~ back f std::vector<int, std::allocator >::reference back() ~ front f std::vector<int, std::allocator >::reference front() ~ operator= f std::vector<int, std::allocator > & operator=(const std::vector<int, std::allocator > & ~ ~vector ~ void ~vector() ~ swap f void swap(std::vector<int, std::allocator > &x) ~ _M_fill_initialize f void _M_fill_initialize(std::vector::size_type __n, const std::vector<int, std::allocator >::v ~ clear f void clear()

Hope this will help