ncm2 / ncm2-pyclang

Cached, fast C/C++ completion for ncm2
MIT License
45 stars 1 forks source link

Is g:ncm2_pyclang#library_path optional? #3

Closed liuchengxu closed 6 years ago

liuchengxu commented 6 years ago

I have tested on a cmake project, ncm2-pyclang still seems to work without configuring g:ncm2_pyclang#library_path.

2018-07-11 3 49 00

Is g:ncm2_pyclang#library_path optional?

roxma commented 6 years ago

It works if libclang.so is in your LIBRARY_PATH environment variable.

On my debian PC, the default libclang.so in my LIBRARY_PATH is clang-3.8, which is kinda old. I tend to use a newer version.

liuchengxu commented 6 years ago

hmm, LIBRARY_PATH is empty on my macOS. still works?

roxma commented 6 years ago

My mistake. It should be LD_LIBRARY_PATH

liuchengxu commented 6 years ago

LD_LIBRARY_PATH is empty as well :).

This is what I got:

~ ❯❯❯ printenv | grep PATH
GOPATH=/Users/xlc/go
NIX_PATH=/nix/var/nix/profiles/per-user/root/channels
RUST_SRC_PATH=/Users/xlc/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/src
PATH=/Users/xlc/.local/bin:/usr/local/bin:/usr/local/opt/php@7.1/sbin:/usr/local/opt/php@7.1/bin:/usr/local/opt/apr/bin:/Users/xlc/go/bin:/Users/xlc/anaconda3/bin:/usr/local/opt/ruby/bin:/Users/xlc/bin:/Users/xlc/.cargo/bin:/usr/local/opt/coreutils/libexec/gnubin:/Users/xlc/.nix-profile/bin:/Users/xlc/.nix-profile/lib/kde4/libexec:/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default:/nix/var/nix/profiles/default/lib/kde4/libexec:/Users/xlc/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Users/xlc/.fzf/bin

And I think the system libclang on macOS is located at /Library/Developer/CommandLineTools/usr/lib/libclang.dylib.

liuchengxu commented 6 years ago

Some more libclang.dylib are found.

/usr/local/lib/libclang.dylib
/usr/local/wasm/lib/libclang.dylib
/Applications/Xcode.app/Contents/Frameworks/libclang.dylib
/Library/Developer/CommandLineTools/usr/lib/libclang.dylib
/usr/local/Cellar/llvm@4/4.0.1/lib/libclang.dylib

Is there a way to identify which libclang.dylib is used?

roxma commented 6 years ago

On linux there's /proc/pid/maps that shows current memory map.

roxma-pc ncm2 $ cat /proc/24679/maps  | grep libclang
7feb36531000-7feb37dcc000 r-xp 00000000 08:01 12893865                   /usr/lib/x86_64-linux-gnu/libclang-6.0.so.1
7feb37dcc000-7feb37dcd000 ---p 0189b000 08:01 12893865                   /usr/lib/x86_64-linux-gnu/libclang-6.0.so.1
7feb37dcd000-7feb37eb2000 r--p 0189b000 08:01 12893865                   /usr/lib/x86_64-linux-gnu/libclang-6.0.so.1
7feb37eb2000-7feb37eb4000 rw-p 01980000 08:01 12893865                   /usr/lib/x86_64-linux-gnu/libclang-6.0.so.1

I'm not sure it's available on unix. But there should be tools available to inspect memory map.

liuchengxu commented 6 years ago

Thanks for your reply. I have confirmed that it's /usr/local/lib/libclang.dylib that is used in ncm2-pyclang.