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

pattern not found #39

Closed
bowu opened this issue Apr 12, 2011 · 7 comments
Closed

pattern not found #39

bowu opened this issue Apr 12, 2011 · 7 comments

Comments

@bowu
Copy link

bowu commented Apr 12, 2011

Vim keeps saying "pattern not found" for the following code.

include

int main()
{
std::string s;
s.
}

even if I have done the following.

  1. Copy clang_complete.vim to .vim/plugin
  2. Installed a working clang.
  3. Removed all omni complete files.

Any suggestions? For example, does clang complete have conflict with some other plugins other than omni complete?

P.S. Clang version is 2.9, vim version is 7.3 (But I also tried 7.2). The same problem happens even if I deleted all other stuff except plugin/clang_complete.vim. In .vimrc, I removed almost everything. If I enable g:clang_complete_copen, a window pops up and says "unknown argument: '->, '

Bo

@jnz
Copy link

jnz commented Apr 13, 2011

Have you only installed the file "clang_complete.vim"? There are other files in clang_complete as well (i. e. the autoload directory and the .py files).

@lostar
Copy link

lostar commented May 2, 2011

Hi,

I've the same issue with fresh .cpp file that contains:

#include <vector>

int main()
{
    std::vector v; <-- plugin displayed (after ::) list where I've found vector
    v.    <-- Here I've got error in VIM status bar: -- User defined completion (^U^N^P) Pattern not found
}

OS: Mac OS X 10.6.7
VIM 7.3 (from MacPorts) with Python2.6 support
Python2.6 (from MacPorts)
clang2.9 (form MacPorts)

.vimrc / .gvimrc:

let g:clang_complete_auto = 1
let g:clang_use_library = 1
let g:clang_library_path = "/opt/local/lib"
lostar@lostar-mbp:~/.vim$ tree
.
├── after
│   └── ftplugin
├── autoload
│   ├── manpageview.vim
│   └── snippets
│       ├── clang_complete.vim
│       ├── dummy.vim
│       ├── snipmate.vim
│       └── ultisnips.vim
├── clang_complete
│   ├── LICENSE
│   ├── README
│   ├── autoload
│   │   └── snippets
│   │       ├── clang_complete.vim
│   │       ├── dummy.vim
│   │       ├── snipmate.vim
│   │       └── ultisnips.vim
│   └── plugin
│       ├── clang
│       │   ├── __init__.py
│       │   └── cindex.py
│       ├── clang_complete.vim
│       └── libclang.py
├── colors
│   └── twilight.vim
├── default
├── doc
│   ├── NERD_commenter.txt
│   ├── NERD_tree.txt
│   ├── manpageview.txt
│   └── matchit.txt
├── plugin
│   ├── NERD_commenter.vim
│   ├── NERD_tree.vim
│   ├── clang
│   │   ├── __init__.py
│   │   ├── __init__.pyc
│   │   ├── cindex.py
│   │   └── cindex.pyc
│   ├── clang_complete.vim
│   ├── libclang.py
│   ├── manpageviewPlugin.vim
│   └── matchit.vim
└── syntax
    ├── info.vim
    ├── man.vim
    ├── mankey.vim
    └── manphp.vim

14 directories, 35 files

p.s. Is it possible to use preinstalled (by Apple) clang? Looks like it was installed with XCode 4.

@lostar
Copy link

lostar commented May 2, 2011

MacVim somehow (very slow) work only with Apple preinstalled clang library. When I've changed path to clang (installed by MacPorts to /opt/local/lib) in .gvim that MacVim display error on start:

"t.cpp" 6L, 50C
Error detected while processing function <SNR>12_ClangCompleteInit..<SNR>12_initClangCompletePython:
line   13:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/lostar/.vim/plugin/libclang.py", line 1, in <module>
    from clang.cindex import *
  File "/Users/lostar/.vim/plugin/clang/cindex.py", line 89, in <module>
    lib = get_cindex_library()
  File "/Users/lostar/.vim/plugin/clang/cindex.py", line 81, in get_cindex_library
    return cdll.LoadLibrary(path)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ctypes/__init__.py", line 431, in LoadLibrary
    return self._dlltype(name)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ctypes/__init__.py", line 353, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(/opt/local/lib/libclang.dylib, 6): Library not loaded: @executable_path/../lib/libLLVM-2.9.dylib
  Referenced from: /opt/local/lib/libclang.dylib
  Reason: image not found
line   14:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'initClangComplete' is not defined
Press ENTER or type command to continue

I've tried to play with DYLIB_LIBRARY_PATH but no luck:

lostar@lostar-mbp:~/Projects/personal/excercises$ DYLD_LIBRARY_PATH=/opt/local/lib mvim t.cpp
dyld: Symbol not found: __cg_png_create_info_struct
  Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /opt/local/lib/libPng.dylib
 in /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
Trace/BPT trap

@Silex
Copy link
Collaborator

Silex commented May 2, 2011

Well afaik the clang that comes with xcode is pretty out of date and you need the last one if you want the "fast" version of libclang...

The problem you apparently have is that the macports versions links dynamically and then fails loading @executable_path/../lib/libLLVM-2.9.dylib for some reasons. Check the macports options about libclang, maybe you can link statically... or try to locate where the missing libs are and fix the paths.

What I did on OSX was that I followed the instructions at http://clang.llvm.org/get_started.html, along with the ones on the wiki on this project and was able to build a libclang.dylib that had everything statically linked, then I only played with g:clang_library_path and things worked.

Once stuff works, if things are still slow please tell I do know a workaround.

@Silex
Copy link
Collaborator

Silex commented May 2, 2011

Also if completion doesn't trigger properly when you write the dot, try <C-x><C-u> to trigger it manually.

@lostar
Copy link

lostar commented May 3, 2011

I've found problem with completion... It is my epic fail :)
My source code has silly error - vector template requires template argument.
After that I replaced std::vector v; with std::vector<int> v; all works like charm.
I'm sorry. Let's close this issue :)

Regarding issues with loading libclang (maybe move this information to other issue?):
I've rebuild MacPort clang package without --enable-shared configure key.
But looks like there is other issue... The current version of clang from MacPorts possibly will conflict with Apple preinstalled. I'm not sure but there is opened issue on MacPorts tracker: https://trac.macports.org/ticket/29171
So I've decided move built clang library (and related files) to ~/.vim/plugins/clang/lib folder:

lostar@lostar-mbp:~/.vim/plugin/clang/lib$ tree
.
├── clang
│   └── 2.9
│       └── include
│           ├── altivec.h
│           ├── arm_neon.h
│           ├── avxintrin.h
│           ├── emmintrin.h
│           ├── float.h
│           ├── immintrin.h
│           ├── iso646.h
│           ├── limits.h
│           ├── mm_malloc.h
│           ├── mmintrin.h
│           ├── nmmintrin.h
│           ├── pmmintrin.h
│           ├── smmintrin.h
│           ├── stdarg.h
│           ├── stdbool.h
│           ├── stddef.h
│           ├── stdint.h
│           ├── tgmath.h
│           ├── tmmintrin.h
│           ├── varargs.h
│           ├── wmmintrin.h
│           ├── x86intrin.h
│           └── xmmintrin.h
├── libclang.a
└── libclang.dylib

3 directories, 25 files

Now VIM and MacVim can work with clang library.

@Silex
Copy link
Collaborator

Silex commented May 3, 2011

Yes, this is what I did too (move the files inside .vim folder).

I see that you moved the .h too, which for some reasons is required by libclang in order for it to be fast (create the parse cache). Without those .h libclang is slow. I'm not sure if we should report that too...

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

No branches or pull requests

4 participants