clang_complete icon indicating copy to clipboard operation
clang_complete copied to clipboard

Loading libclang failed, falling back to clang executable (mountain lion, with and without setting g:clang_library_path)

Open aliak00 opened this issue 12 years ago • 10 comments

Hi,

Having some trouble on Mountain Lion with clang_complete. Setup is: vim 7.3 (+python but -python3) clang 4.2 I don't think I have any omnicpp stuff because I can't find any thing referring to it in the .vim/plugins I have libclang in two places, one of which is /use/lib/ but even if I put

let g:clang_library_path="/usr/lib/"

in my .vimrc, I get the loading libclang failed message. If I leave it blank, I get the try setting the path message.

Any ideas?

Thanks for a great plugin btw :)

aliak00 avatar Feb 28 '13 00:02 aliak00

On 02/28/2013 01:55 AM, aliak00 wrote:

Hi,

Having some trouble on Mountain Lion with clang_complete. Setup is: vim 7.3 (+python but -python3) clang 4.2

You mean clang 3.2?

I don't think I have any omnicpp stuff because I can't find any thing referring to it in the .vim/plugins I have libclang in two places, one of which is /use/lib/ but even if I put

let g:clang_library_path="/usr/lib/"

in my .vimrc, I get the loading libclang failed message. If I leave it blank, I get the try setting the path message.

Any ideas?

What error message do you get, in case you provide the library path? Did you try setting g:clang_use_library = 1 and g:clang_debug = 1. This may give you some additional information.

Tobias

tobiasgrosser avatar Feb 28 '13 07:02 tobiasgrosser

I guess it's based off of 3.2? clang -v gives me: Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn)

It's the one that comes with xcode 4.2

When I provide the library path I get: "setting library path to /usr/lib/ Loading libclang failed, falling back to clang executable. Are you sure '/usr/lib/' contains libclang?"

Without the library path I get: "Loading libclang failed, falling back to clang executable. Consider setting g:clang_library_path"

Then I get this (for both with library path set and without: "Error detected while processing function <SNR>12_ClangCompleteInit: line 152: clang_complete: Not using libclang is deprecated, line 153: You should switch to libclang now and report all the bugs."

Just for reference, this is what's in my vimrc:

32 let g:clang_use_library=1 33 " let g:clang_library_path="/usr/lib/" 34 let g:clang_auto_select=1 "select first entry in popup menu but don't insert in code 35 let g:clang_complete_auto=1 "auto complete after -> . and :: 36 let g:clang_complete_copen=1 "open quick fix on error 37 let g:clang_complete_hl_errors=1 " highlight errors and warnings 38 let g:clang_periodic_quickfix=1 " update quickfix periodically 39 let g:clang_trailing_placeholder=1 " add trailing placeholder after function 40 let g:clang_close_preview=1 " close preview window after completion 41 let g:clang_user_options='-Wc++11-extensions -std=c++0x -I/usr/lib/c++/v1/ -I/Users/aliak/dev/source/boost_1_53_0 -std=c++11' 42 let g:clang_snippets=1 " some magic after function ( or , 43 let g:clang_snippets_engine='snipmate' 44 let g:clang_debug=1

aliak00 avatar Feb 28 '13 22:02 aliak00

I have the same problem. My system is gentoo, vim 7.3.409 built with python support, clang 3.2. When I don't set g:clang_library_path, the error is (when I open a .cpp file): Loading libclang failed, falling back to clang executable. Consider se tting g:clang_library_path Error detected while processing function <SNR>17_ClangCompleteInit: line 152: clang_complete: Not using libclang is deprecated, line 153: You should switch to libclang now and report all the bugs.

When I set g:clang_library_path="/usr/lib/llvm", this error is disappear but when I move the cursor, another error occur:

Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib64/python2.7/threading.py", line 551, in __bootstrap_in ner self.run() File "/home/tom/.vim/plugin/libclang.py", line 433, in run self.timer) File "/home/tom/.vim/bundle/clang_complete/plugin/libclang.py", line 35, in getCurrentTranslationUnit flags = TranslationUnit.PrecompiledPreamble | TranslationUnit.CXXPr ecompiledPreamble # | TranslationUnit.CacheCompletionResults AttributeError: type object 'TranslationUnit' has no attribute 'Precomp iledPreamble'

Thanks, Tom

vanthonguyen avatar Mar 03 '13 14:03 vanthonguyen

On 03/03/2013 03:45 PM, thonguyen wrote:

I have the same problem. My system is gentoo, vim 7.3.409 built with python support, clang 3.2. When I don't set g:clang_library_path, the error is (when I open a .cpp file): Loading libclang failed, falling back to clang executable. Consider se tting g:clang_library_path Error detected while processing function <SNR>17_ClangCompleteInit: line 152: clang_complete: Not using libclang is deprecated, line 153: You should switch to libclang now and report all the bugs.

When I set g:clang_library_path="/usr/lib/llvm", this error is disappear but when I move the cursor, another error occur:

If you need to specify the library path, it seems libclang.so is not correctly registered in the shared library path. You may want to report this to gentoo.

Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib64/python2.7/threading.py", line 551, in __bootstrap_in ner self.run() File "/home/tom/.vim/plugin/libclang.py", line 433, in run self.timer) File "/home/tom/.vim/bundle/clang_complete/plugin/libclang.py", line 35, in getCurrentTranslationUnit flags = TranslationUnit.PrecompiledPreamble | TranslationUnit.CXXPr ecompiledPreamble # | TranslationUnit.CacheCompletionResults AttributeError: type object 'TranslationUnit' has no attribute 'Precomp iledPreamble'

This error is interesting. Especially as the line

"flags = TranslationUnit.PrecompiledPreamble | TranslationUnit.CXXPrecompiledPreamble # | TranslationUnit.CacheCompletionResults"

does not exist in a recent version of clang_complete.

Are you sure you have the latest version of clang_complete and only a single copy of it. I am a little surprised as there are two versions of libclang.py mentioned in the above backtrace:

/home/tom/.vim/plugin/libclang.py /home/tom/.vim/bundle/clang_complete/plugin/libclang.py

Tobi

tobiasgrosser avatar Mar 03 '13 16:03 tobiasgrosser

Thank Tobi, I have fixed 2 problems by adding /usr/lib/llvm to LD_LIBRARY_PATH and remove the older version of clang_complete. Now it works. :+1:

vanthonguyen avatar Mar 04 '13 05:03 vanthonguyen

Great!

xavierd avatar Mar 04 '13 05:03 xavierd

On my system I had this issue too. It was because there is no libclang.so in Ubuntu 13.04 but a libclang.so.1, after symlinking everything worked, probably you should try numbered releases as well?

NobbZ avatar Aug 25 '13 09:08 NobbZ

I don't understand, should I be using llvm or libclang? Is there a difference in results? I'm also trying to get it to work on Gentoo with the latest version of clang_complete. I have clang-3.3 installed, but no libclang in /usr/lib.. But I do have: -rw-r--r-- 1 root root 399K 10 okt 22.38 /usr/lib/clang/3.3/lib/linux/libclang_rt.asan-i386.a -rw-r--r-- 1 root root 488K 10 okt 22.38 /usr/lib/clang/3.3/lib/linux/libclang_rt.asan-x86_64.a -rw-r--r-- 1 root root 180K 10 okt 22.38 /usr/lib/clang/3.3/lib/linux/libclang_rt.full-x86_64.a -rw-r--r-- 1 root root 359K 10 okt 22.38 /usr/lib/clang/3.3/lib/linux/libclang_rt.msan-x86_64.a -rw-r--r-- 1 root root 11K 10 okt 22.38 /usr/lib/clang/3.3/lib/linux/libclang_rt.profile-x86_64.a -rw-r--r-- 1 root root 123K 10 okt 22.38 /usr/lib/clang/3.3/lib/linux/libclang_rt.san-i386.a -rw-r--r-- 1 root root 149K 10 okt 22.38 /usr/lib/clang/3.3/lib/linux/libclang_rt.san-x86_64.a -rw-r--r-- 1 root root 825K 10 okt 22.38 /usr/lib/clang/3.3/lib/linux/libclang_rt.tsan-x86_64.a -rw-r--r-- 1 root root 264K 10 okt 22.38 /usr/lib/clang/3.3/lib/linux/libclang_rt.ubsan_cxx-i386.a -rw-r--r-- 1 root root 523K 10 okt 22.38 /usr/lib/clang/3.3/lib/linux/libclang_rt.ubsan_cxx-x86_64.a -rw-r--r-- 1 root root 29K 10 okt 22.38 /usr/lib/clang/3.3/lib/linux/libclang_rt.ubsan-i386.a -rw-r--r-- 1 root root 35K 10 okt 22.38 /usr/lib/clang/3.3/lib/linux/libclang_rt.ubsan-x86_64.a

Edit: Nevermind! I found it in the /usr/lib/llvm/ directory, just like thongyen above. And here I thought the llvm-path was to a binary.. Sorry, my bad.

AzP avatar Nov 22 '13 15:11 AzP

@NobbZ Same problem to me on crunchbang. Symlinking solved it:

sudo ln -s /usr/lib/libclang.so.1 /usr/lib/libclang.so

xy124 avatar Mar 27 '15 13:03 xy124

let g:clang_library_path='/usr/lib/llvm3.5/libclang.so.1' in ~/.vimrc and it works.

jbgnaw avatar Jun 04 '15 23:06 jbgnaw