Getting "Vim: Caught deadly signal ABRT" after install.
utkarshkukreti opened this issue · 79 comments
I'm on OSX 10.8.2.
Steps I followed:
cd ~/.vim/bundle
git clone https://github.com/Valloric/YouCompleteMe.git
mkdir ~/dev/ycm_build
cd ~/dev/ycm_build
cmake -G "Unix Makefiles" . ~/.vim/bundle/YouCompleteMe/cpp
Got this output.
Now when I start vim, I get this:
➜ ycm_build vim
Vim: Caught deadly signal ABRT
Vim: Finished.
[1] 10720 abort vim
➜ ycm_build vim
Vim: Caught deadly signal ABRT
Vim: Finished.
[1] 10740 abort vim
vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jan 21 2013 00:59:00)
MacOS X (unix) version
Included patches: 1-772
If you need any more info, let me know. :)
Are you using the MacPorts version of Vim? If so, you're gonna have a bad time. :)
Seriously though, I've heard that getting YCM working with MacPorts Vim is tricky because YCM will link in the system version of Python whereas the MacPorts Vim links in the MacPorts Python. Segfaults ensue.
A co-worker got it working and sent me the instructions, but I don't have them near me. I'll update this issue and the README when I do.
I recommend MacVim. MacVim.app has a normal Vim binary inside the package which you can just call if you want the console Vim experience.
But while we're at it, delete everything in your build directory and paste me the output of your cmake call.
I'm not using MacPorts, I installed the HEAD version (as of Jan 2013) of vim using Homebrew [more info].
Here's the cmake output.
Hm, most interesting...
Please paste me the full output of vim --version
.
vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jan 21 2013 00:59:00)
MacOS X (unix) version
Included patches: 1-772
Compiled by utkarsh@Utkarshs-MacBook-Air.local
Huge version without GUI. Features included (+) or not (-):
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent
-clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs
-dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path
+find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv
+insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape
+mouse_dec -mouse_gpm -mouse_jsbterm +mouse_netterm +mouse_sgr -mouse_sysmouse
+mouse_urxvt +mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg
+path_extra -perl +persistent_undo +postscript +printer +profile +python
-python3 +quickfix +reltime +rightleft +ruby +scrollbind +signs +smartindent
-sniff +startuptime +statusline -sun_workshop +syntax +tag_binary
+tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title
-toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
+vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
-xterm_clipboard -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H -F/usr/local/Frameworks -DMACOS_X_UNIX -no-cpp-precomp -Os -w -pipe -march=native -Qunused-arguments -mmacosx-version-min=10.8 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: /usr/bin/clang -L. -L/usr/local/lib -L/Users/utkarsh/.rvm/usr/lib -L/usr/local/lib -F/usr/local/Frameworks -o vim -lm -lncurses -liconv -framework Cocoa -framework Python -lruby.1.9.1 -lobjc -L/Users/utkarsh/.rvm/rubies/ruby-1.9.3-p327/lib
I'm officially stumped. Everything looks fine...
Could you download the latest MacVim and try that out? Just so that we rule out some things. If it works with MacVim, then the problem is in the way brew configured and compiled your vim binary.
Was just doing that. Will report in in a few minutes.
I get this error, I'm not sure which mapping it's referring to, but the plugin seems to be working fine.
E227: mapping already exists for <80><fc>^D
I guess the problem is with brew's vim compilation config?
Yeah, that error is telling you that YCM failed to create one of its key mappings, and by the looks of it it's <leader>d
. I'm guessing you already have something mapped to it. See the Options section in the docs about changing that mapping to something else and the error will go away.
Brew seems to be screwing up something with vim's compilation, yes. I don't know what.
Again, I recommend MacVim.
Didn't know MacVim shipped with a console version! /Applications/MacVim.app/Contents/MacOS/Vim
seems to be working well.
Thank you. :)
Yeah, MacVim actually runs a full, normal instance of Vim in the background that the GUI talks to. It's actually a pretty clever design that makes it very easy for MacVim to keep track of upstream Vim development.
I little off-topic, but I couldn't find this in the README (Maybe I didn't read it properly), how would I go about creating some simple completion modifications for other post types? Say, just add a few completion words by default for a specific file type?
That would be non-trivial, but not too difficult to do. Take a look at
how the two current completers use the completer.py
API. You'd have to
write your own completer though.
On Sat, Feb 2, 2013 at 10:37 PM, Utkarsh Kukreti
notifications@github.comwrote:
I little off-topic, but I couldn't find this in the README (Maybe I didn't
read it properly), how would I go about creating some simple completion
modifications for other post types? Say, just add a few completion words by
default for a specific file type?—
Reply to this email directly or view it on GitHubhttps://github.com//issues/8#issuecomment-13043211.
The workaround in #18 works in here too.
DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_INSERT_LIBRARIES=/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib vim
And vim will start fine.
But any better solutions?
Actually a single DYLD_FORCE_FLAT_NAMESPACE=1
will make things work.
I have updated the newest version of the plugin but it's still broken. Any idea?
I have the same problem, I get Fatal Python error: PyThreadState_Get: no current thread
. Works with DYLD_FORCE_FLAT_NAMESPACE=1
.
Same, I wonder if there is a way to fix install.sh to include this flag so we don't have to pass that every time we want to open Vim?
Similar issue as the OP after update.
$ vim
Vim: Caught deadly signal ABRT
Vim: Finished.
Abort trap: 6
This works:
$ DYLD_FORCE_FLAT_NAMESPACE=1 vim
I got the same problem and need to to use DYLD_FORCE_FLAT_NAMESPACE=1 as the workaround. Any idea how to fix this for good?
Mac OS X 10.8.3, binary MacVim and Homebrew python. Using the following command to change the linked framework for MacVim fixed the problem for me (see more here).
install_name_tool -change /System/Library/Frameworks/Python.framework/Versions/2.7/Python /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/Python MacVim
This ticket is quite old, but since it keeps getting referenced I thought I'd give some insight in how to use YCM with vim compiled from MacPorts (same probably applies to Homebrew). As previously noted in this ticket, building YCM against a different Python version than vim itself can cause problems.
We can switch the version of Python used by YCM in a few spots:
- At load time using
DYLD_INSERT_LIBRARIES
.DYLD_FORCE_FLAT_NAMESPACE
works at the same point in time. While those might work depending on your current configuration they rely on system Python and whatever custom Python you have to be binary compatible. - After building using
install_name_tool
to swap the Python library being referenced by the loadable module (or even worse, the MacVim binary). This will also only work, if the Python implementations being swapped are binary compatible. - At compile time using the
-DPYTHON_LIBRARY
and-DPYTHON_INCLUDE_DIR
settings forcmake
. This is advisable, because it will actually use the set of headers that will match the library that will later be used, rather than replacing the library later and hoping the headers will be compatible with the swapped library.
YCM actually tries hard to get this right using function python_finder
in install.sh
. This will, however, not work correctly, if your custom python-config
tool is not in $PATH
when installing YCM. For MacPorts, you should sudo port select --set python python27
(or whatever version you used to compile vim) to fulfill this requirement. If you want to restore your previous setting afterwards, check what it was using port select --list python
(it's the one marked active).
If you got Python installed using Homebrew, before doing YouCompleteMe installation, unlink it
brew unlink python
@quanganhdo: I can confirm that unlinking homebrew python before installation and then linking again afterwards works for me.
I can confirm that under a Python supplied by Homebrew, @neverpanic's third option works by passing the -DPYTHON_LIBRARY and -DPYTHON_INCLUDE_DIR settings when running cmake.
Finding exactly which two directories to supply those settings isn't intuitive or easy (at least it wasn't for me), so in the interest of helping those who are also having this problem the following one-liner should work for those using a Homebrew'd Python 2.7.x:
cmake -G "Unix Makefiles" -DPYTHON_LIBRARY=/usr/local/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib -DPYTHON_INCLUDE_DIR=/usr/local/Frameworks/Python.framework/Versions/2.7/Headers -DPATH_TO_LLVM_ROOT=~/ycm_temp/llvm_root_dir . ~/.vim/bundle/YouCompleteMe/cpp
Be sure to change -DPATH_TO_LLVM_ROOT=~/ycm_temp/llvm_root_dir
to the right directory containing the clang libraries and binaries.
If, for some reason, it you need to edit the cmake configuration directly, go to the temporary build directory and use ccmake .
Type t
and edit the appropriate fields with the above paths to the Homebrew'd Include Dir and Library file.
I'm using a compiled Vim 7.4, Python 2.7.5, and Mac OS X 10.8.4
brew unlink python
as mentioned by @quanganhdo above fixed the issue with Vim 7.4 on OS X 10.8.4.
brew unlink python
does not work for me.
Please, people. Stop spamming this issue with "I ran some command of my package manager and it didn't work" and invest 15 minutes into getting what the problem is as outlined above, find out which python is used by the vim binary you are trying to use and build your YCM against that very same python. All of this really differs by what vim binary you're trying to use and in what way it was built.
And if you can't figure it out on your own, consider having your package manager people port YCM for you, so they can do the right thing for you.
Hey everyone, thanks for this thread. I am also getting this issue and I am looking through some of your comments, so I see there are multiple things to try. But I still do not quite understand why this is happening. At one point Valloric said he thought it was because install.sh failed to map a leader, but then it seemed like that was not true and instead of may have been a matter of what version of python was installed when some of the subprocesses of the instal.sh file were run?
Additionally, I do not understand why the vim that comes with MacVim is somehow more useable than any other. Can anyone else explain this?
One other thing, can anyone point me in the direction of some documentation regarding the issues that may arise or the complete process of creating a symlink to the binary that comes with MacVim? I am concerned that my .vimrc, for example, may not work (I've been using vim for a while and have configured it quite well for my needs) or that it won't be able to find the location of my bundles, etc, I would just like to know what the possibilities are for messing up my current configuration and know that I have a simple way of getting it back.
Thanks a ton folks
I use Homebrew python and MacVim
I can confirm that neverpanic's second solution works for me by calling it on the Vim binary in MacVim.app
install_name_tool \
-change /System/Library/Frameworks/Python.framework/Versions/2.7/Python \
/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/Python \
/Applications/MacVim.app/Contents/MacOS/Vim
After upgrading to 10.9 I wasn't able to get YCM working at all until tonight. I tried with the vim bundled with MacVim, system vim, and homebrew vim.
$ vim
Vim: Caught deadly signal ABRT
Vim: Finished.
Abort trap: 6
Unlinking the homebrew python allowed vim to start without the ABRT error.
$ brew unlink python
Unlinking /usr/local/Cellar/python/2.7.6... 38 links removed
$ ./install.sh --clang-completer
/var/folders/6t/7h88dl955c3f2ht7d096lp5w0000gn/T/ycm_build.17UwPJ ~/.vim/bundle/YouCompleteMe
-- The C compiler identification is Clang 5.0.0
-- The CXX compiler identification is Clang 5.0.0
...
...
Relinking it triggered the startup crash again.
$ brew link python
Linking /usr/local/Cellar/python/2.7.6... 34 symlinks created
$ vim ~/.vimrc
Vim: Caught deadly signal ABRT
Vim: Finished.
Abort trap: 6
$ echo $?
134
My workaround for now is to leave homebrew python unlinked
I did a fresh install of EVERYTHING on my computer last week and no problems. Did it again this week (stupid apps that don't like case-sensitive drives) and am now getting the same problem as @kogent
There is also the pyenv way of installing Python, which gave me a lot of problems
Everything working after forcing the install script to use the system Python
brew unlink python
worked for me as well.
If you want to find out what your macvim is linked to:
otool -L /usr/local/Cellar/macvim/7.4-72/MacVim.app/Contents/MacOS/Vim
Substitute 7.4-72
with whatever version you have installed. Strangely, my macvim is linked to the system python, and I haven't found any way to link to the homebrewed version.
With the newest Python 2.7.6, this problem reoccurs. Any fix available?
This problem doesn't "reoccur", it has always been there. This is not YCM's fault, but is a user error. Please take the time to actually read and understand what has been written in this ticket and follow the instructions that have been given to resolve this issue. I'll explain it one more time and I'm going to loose faith in humanity if the "this or that worked for me" or "this is still broken" posts don't stop after that.
If you have problems following my how-to after you're read it, feel free to ask (but only after that!).
The Problem
The crash occurs because YCM uses a different Python than your vim/MacVim/GVim/etc. binary. Note that I didn't say different version, because that is not necessarily the case. You can have the same version of Python installed in two different locations and they still might not be compatible.
The solution
Finding the correct Python
The first thing you'll have to do in order to get this fixed is find out which Python is used by the vim binary (or binaries) you are trying to use. To do that, locate the vim binary (e.g. using which vim
for a command line vim, or in the Contents/MacOS
folder of an app bundle). Once you have the path to the binary, run otool -L /path/to/your/vim/binary | grep -i python
. You might need the Command Line Tools package for the otool
command, but you've probably installed it anyway, because YCM might also need it. This command will print the path of the Python library used by your vim. You must make sure YCM is built against that very same library, or this crash will occur.
If you installed your copy of vim using a package manager the result of that command will probably always be the same (e.g. it is /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Python
for MacPorts vim). Note that this doesn't apply if you used homebrew to install vim, because the homebrew people apparently don't care about reproducible builds and their vim links against whatever Python it finds first (which also explains why brew unlink python
or brew link python
can never be the one solution for this problem and doesn't work for all of you).
Building YCM against the correct Python
Once you've identified the correct Python library you need to make sure YCM's build system will pick up this Python to build against. https://github.com/Valloric/YouCompleteMe/blob/master/install.sh#L28 contains the code that will find the Python to link against; as you can see, it will execute python-config
in line 34 and python
in line 39. We need to make sure these executables match the library we want to use.
For example:
- If your library is
/System/Library/Frameworks/Python.framework/Versions/2.7/Python
, you need to use/usr/bin/python-config
and/usr/bin/python
when building YCM. If you're using a package manager, make sure it doesn't install files in your$PATH
that hide these files, e.g. by usingbrew unlink python
orsudo port select --set python none
. Ifwhich python-config
doesn't print/usr/bin/python-config
andwhich python
doesn't print/usr/bin/python
, your build will produce a broken version. - If your library is
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Python
you're using MacPorts Python. To ensure itspython-config
andpython
tools are the first in your$PATH
runsudo port select --set python python27
. - If your library is
/usr/local/Frameworks/Python.framework/Versions/2.7/Python
, and you're using homebrew, you're probably using homebrew Python. Runbrew link python
to make the appropriatepython-config
andpython
tools first in your$PATH
. - If your library is none of the above, you're on your own to find out where your library came from and where the corresponding
python
andpython-config
tools are. Feel free to update this list for MacPython, ActivePython, etc.
Rebuild YCM, restart vim and it should work fine. Note that you might not be able to build one version of YCM for, say, MacVim and a vim binary if they've been installed from different sources. The easiest way to solve this would probably be to install all versions of vim you need from the same source.
@neverpanic Thank you for this thorough explanation. I feel your frustration. Please take comfort that I have gone through the other issues on this repo, and homebrew's, before posting, primarily since this isn't the first time this problem happened to me (happened in earlier Python versions, I already took the time to report on the homebrew github page and was able to fix it at the time).
This is indeed a Macvim bug - Macvim doesn't link to homebrew's Python very well, causing this whole mess. As mentioned in Homebrew/legacy-homebrew#20392, Homebrew/legacy-homebrew#20075, Homebrew/legacy-homebrew#17908
I really think this should go to YCM's front page or at least its wiki. This will really help people find the source of the problem (which is not YCM), and spare having to explain this over and over again.
I have tried following these instructions, and ran into the following problems.
- When I run
otool -L /path/to/your/vim/binary
I get/usr/local/bin/mvim: is not an object file
.
I wasn't sure what to make of that, though I had thought I had installed the MacVim binary that came in the MacVim application package as my command line vim. So, I tried it on that and got the python and python config that it was pointing to, (/usr/bin/python
, /usr/bin/python-config
) and ran through the brew unlink and install YCM process with these on the path.
- Now, instead of the previous crash, when I run vim, YCM does not run successfully, and I get a
Python quit unexpectedly
prompt. The python it is referring to is/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
, which is not the python I linked YCM to when installing.
/usr/local/bin/mvim
probably isn't the binary, but a script that will execute the correct binary. otool
will only work on the binary itself, not any wrapper scripts.
Your Python crash sounds like while you rebuilt YCM against the Python used by MacVim, your vim
is actually using a different Python, namely homebrew Python from /usr/local/Cellar
. Please make sure both your MacVim and your vim binary use the same Python.
What's the output of which vim
and otool -L $(which vim)
?
which vim
/usr/bin/vim (this is simlinked to /usr/local/bin/mvim)
otool -L $(which vim)
/usr/bin/vim: is not an object file
otool -L $(which mvim)
/usr/local/bin/mvim: is not an object file
I'm not sure who told you changing something in /usr/bin
(such as replacing vim with a symlink) was a good idea, but I guess the damage is done now. You should just have created the symlink in /usr/local/bin
or somewhere else and adjust $PATH
accordingly so your vim-of-choice was first.
Please open /usr/local/bin/mvim
in your favorite text editor (that works) and find out which value $VIM_APP_DIR
and $binary
will have in line 32. Use otool -L
on the value of $binary
and paste the output.
Update:
I rebrewed brewed macvim (following advice here Homebrew/legacy-homebrew#20392), and found that mvim is a script that points to the binary:
/usr/local/Cellar/macvim/7.4-72/MacVim.app/Contents/MacOS/Vim
Running otool
gives me
/System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.5)
I again followed your instruction to brew unlink python, ensure that python and python-config point to /usr/bin/python
and /usr/bin/python
and reinstall YCM, and it works. But if I link python again with brew link python
, python crashes when I run vim again. When I unlink it, YCM works.
Guys, this is a Macvim issue, not YCM's. Because Macvim developers have ignored this for the last few months, Homebrew's devs fixed it the last time. I guess they're gonna be the ones who'll fix this this time as well. Please see the issue I've referenced above.
Issue has been fixed. Please brew uninstall macvim && brew update && brew install macvim
. Note the reference two messages above this one.
I take it back. removing vim and python (all versions) then installing python and then macvim seems to have fixed it
... not wanting to start a war seriously but, stuff like these are one of the reasons I had left OS X as a personal choice for a development environment:
@neverpanic , thank you for giving out the reason.
Here's my solution:
1.
Figure out where your python is.
import sys
print sys.path
edit the install.sh file in YCM
function python_finder {
#python_library="-DPYTHON_LIBRARY="
python_library = "/Users/ldong/.pyenv/versions/2.7.6/lib/python2.7/config"
#python_include="-DPYTHON_INCLUDE_DIR="
python_include="/Users/ldong/.pyenv/versions/2.7.6/lib/python2.7/site-packages"
I've also put let g:ycm_path_to_python_interpreter = '/Users/ldong/.pyenv/shims/python'
in my vimrc file.
PS: pyenv is used for different versions of pythons, happy VIMing.
An up to date homebrew creates two python 2.7.6 directories for me. (I have no idea why, homebrew just does as it pleases.)
$ ls /usr/local/Cellar/python
2.7.6/ 2.7.6_1/
2.7.6_1 is what homebrew actually symlinks in /usr/local/bin and what it uses in /usr/local/Frameworks, and so it's what homebrew vim uses.
The ycm install.sh was using the appropriate python-config but not successfully parsing the output. I'm not sure why, it looks like it should have worked. Maybe something else changed while I was trying to fix this.
in function python_finder I just commented out the logic and dropped these at the end:
python_library+="/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib"
python_include+="/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/include/python2.7"
@neverpanic Your solution and comments are worthy enough for a Wiki page. I would copy it over but I'd want your and @Valloric's permissions first. So 👍 ❓
Sure, go ahead.
@neverpanic amazing explanation, thanks!
In my case correct steps to install YouCompleteMe are:
brew install python --framework
brew install vim
cd ~/.vim/bundle/YouCompleteMe
./install.sh --clang-completer
and everything working perfect.
Watch out for g:ycm_path_to_python_interpreter
in your .vimrc
.
After trying and failing every vim and python install combination on my mac I finally remembered I had set let g:ycm_path_to_python_interpreter = '/usr/bin/python2'
when setting up YCM on a CentOS machine. As soon as I removed the line YCM worked fine on my mac.
@dimitardanailov just followed your steps and everything is working fine for me as well. Thanks!
Just upgraded YCM and ran into this issue again.
Can't remember how I solved it last time, but this time a simple $ brew reinstall macvim
did the trick.
For anaconda users,
Just temporarily change the python-config
file in /path/to/anaconda/bin/python-config to python-config.tmp
while compiling YCM and rename back to normal. It will do the trick.
when I ran otool
and found system-python is in /usr/bin
, but my new installed python.org's python 2.7.9 is in /usr/local/bin
.
according @neverpanic 's comment, I know I use the wrong python to compile YCM.
Inspired by @ldong , I just hacked the build.sh
a little
replace python-config
(line 33) with /usr/bin/python-config
and python
(line 38) with /usr/bin/python
python_finder() {
# The CMake 'FindPythonLibs' Module does not work properly.
# So we are forced to do its job for it.
python_prefix=$(/usr/bin/python-config --prefix | sed 's/^[ \t]*//')
if [ -f "${python_prefix}/Python" ]; then
python_library="${python_prefix}/Python"
python_include="${python_prefix}/Headers"
else
which_python=$(/usr/bin/python -c 'import sys;i=sys.version_info;print "python%d.%d" % (i.major, i.minor)')
lib_python="${python_prefix}/lib/lib${which_python}"
if [ -f "${lib_python}.a" ]; then
python_library="${lib_python}.a"
# This check is for for CYGWIN
elif [ -f "${lib_python}.dll.a" ]; then
python_library="${lib_python}.dll.a"
else
python_library="${lib_python}.dylib"
fi
python_include="${python_prefix}/include/${which_python}"
fi
echo "-DPYTHON_LIBRARY=${python_library} -DPYTHON_INCLUDE_DIR=${python_include}"
}
after running ./install.sh
, everything is fine except Python crashes everytime opening vim in terminal
add following line in .vimrc
will fix the problem
let g:ycm_path_to_python_interpreter = "/usr/bin/python"
If you have MacPorts, and you ran port select
for 2.7, and are using latest YCM where build.py
is used:
env EXTRA_CMAKE_ARGS='-DPYTHON_EXECUTABLE=/opt/local/bin/python' bash install.sh --clang-completer
Having PATH
set correctly is not enough.
@dimitardanailov's steps also worked for me. After I executed brew install python --framework
and reinstalled Vim through brew, the output for otool -L
which vim | grep -i python
changed from:
/System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.6)
to:
/usr/local/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.0)
And it worked. I'm not completely sure why this works and if this is a preferable solution. I would like that Vim uses the brewed Python instead of OS X's default one, so it would use the same version as YCM. Then you also don't have to do anything special for YCM's installation.
But this solution apparently makes Vim use the Python located in /usr/local/Frameworks/Python.framework/Versions/2.7/Python
, while which python
+ following all the symlinks comes down to /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/bin/python2.7
, so I don't see why this works.
Anybody has an idea about this?
@dimitardanailov 's answer also works for me, "unlink python" and " reinstall vim from brew" are necessary.
Using MacPorts w/Python 2.7.10 on Mavericks.
I'm also using the MacPorts Vim (with the above Python as a variant).
% sudo port select --set python python27
% which python
/opt/local/bin/python
% otool -L /opt/local/bin/vim | grep Python
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.0)
Everytime I run the install.sh
script I see:
...
-- Found PythonLibs: /System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib (found suitable version "2.7.6", minimum required is "2.6")
-- Found PythonInterp: /opt/local/bin/python (found suitable version "2.7.10", minimum required is "2.6")
...
PythonLibs
is pointing to Mac's built-in python (2.7.6).PythonInterp
is pointing to MacPorts python (2.7.10).
I also tried @Tatsh recommendation, with same results:
% env EXTRA_CMAKE_ARGS='-DPYTHON_EXECUTABLE=/opt/local/bin/python' bash install.sh --clang-completer
Am I missing an extra step?
@juztin As stated in my original comment, Having PATH set correctly is not enough. My PATH
places MacPorts bin
directory way before others:
PATH=/opt/local/libexec/gnubin:/opt/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
See if this works:
env PATH=/opt/local/libexec/gnubin:/opt/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin EXTRA_CMAKE_ARGS='-DPYTHON_EXECUTABLE=/opt/local/bin/python' bash install.sh --clang-completer
There is a difference when you put /opt/local/bin
last, or after /usr/bin
where Apple's Python is. Incorrect action occurs:
env PATH=/bin:/usr/bin:/usr/sbin:/opt/local/bin EXTRA_CMAKE_ARGS='-DPYTHON_EXECUTABLE=/opt/local/bin/python' bash install.sh --clang-completer
...
-- Found PythonLibs: /System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib (found suitable version "2.7.6", minimum required is "2.6")
-- Found PythonInterp: /opt/local/bin/python (found suitable version "2.7.10", minimum required is "2.6")
This is all based on whatever the FindPythonLibs
CMake module does, which is partially dependent on what FindPythonInterp
does but not totally.
I recommend placing MacPorts path(s) before the general system ones, and I have had zero issues with this. Also, I use MacPorts' Bash shell not Apple's (ancient) Bash.
No dice...
/opt/local/...
paths do occur very first in my PATH
env.
Executing the below gives me the same result:
PythonLibs
points to built-in 2.7.6PythonInterp
points to 2.7.10.
env PATH=/opt/local/libexec/gnubin:/opt/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin EXTRA_CMAKE_ARGS='-DPYTHON_EXECUTABLE=/opt/local/bin/python' bash install.sh --clang-completer --gocode-completer
I was digging a bit in the source and it looks like the 2 above paths are not discovered via CMake
./third_party/ycmb/build.py
def CustomPythonCmakeArgs():
# The CMake 'FindPythonLibs' Module does not work properly.
# So we are forced to do its job for it.
python_prefix = sh.python_config( '--prefix' ).strip()
...
EDIT
MacPorts, on one machine, did NOT create this symlink but did on another.
Also Vim only seemed to link to MacPorts Python when supplying a single Py variant
(If both +python27 and +python34 are supplied it links to the Apple Python)
I finally tried creating the symlink python-config
in /opt/local/bin
to point to /opt/local/bin/python27-config
, as this didn't exist.
Now I got the opposite issue (just running ./install.sh
):
PythonLibs
points to built-in 2.7.10PythonInterp
points to 2.7.6.
With the above symlink AND the EXTRA_CMAKE_ARGS
variable things ended up working.
% EXTRA_CMAKE_ARGS='-DPYTHON_EXECUTABLE=/opt/local/bin/python' bash install.sh --clang-completer --gocode-completer
@Tatsh thanks for helping me get this working =)
brew unlink python
fixed the problem here.
@neverpanic solution works for me
my vim version 7.4.729 installed by macports
use port select --set python python27
to select the right python version
and all works fine
I met this today , I have the system default installed python 2.7.6 and brew installed python 2.7.10_2 , after install the Ycm for vim , I got this error messages , and I do the brew unlink Python
, vim is back to work
Encountered this on OSX Yosemite (10.10), homebrew python 2.7.10_2, MacVim 7.4-769, cmake 3.1.3.
MacVim was compiled with the brewed python, but when compiling YCM the system python was used for some reason, as I'm sure was the problem for others here.
Fixed this by adding -DPYTHON_INCLUDE_DIR=$(python-config --prefix)/Headers
to the cmake
command used for generating YCM's Makefiles. The cmake
output showed that this way it found the correct python libs. (Note that python-config
is of course from the brewed python.)
I didn't see this exact solution here. I hope it helps someone.
@neverpanic Thank you for your explication. I just change the /usr/bin
before PATH
and rebuild youcompleteme project, and anything goes well. Just Thank you.
Experienced this error today, was also fixed by brew unlink python
- thanks, @wangwenchao
Also hit this issue, even though my install was working previously. Thanks all for the contributions, thorough explanations and workarounds. 👍
A quick solution, don't need to brew unlink python
, and also available for Anaconda
:
$ export PATH="/usr/bin:$PATH"
$ which python
/usr/bin/python
$ python installer.py --clang-completer
^ didn't work for me. Actually broke my workaround too. :'(
Here is what I used to get:
$ vim
Vim: Caught deadly signal ABRT
Vim: Finished.
Abort trap: 6
Adding export DYLD_FORCE_FLAT_NAMESPACE=1
to ~/.bash_profile
worked for me on OSX 10.11.1, but I had to update all of my plugins (using Vundle) and then recompile YCM (by running its install.sh
).
Hope that helps.
I am also using OSX 10.11.1 and experienced same problem as @georgethebeatle. solution from @dimitardanailov saved me, the most important thing you should keep in mind is that after reinstall python with brew install python --framework
, reinstall vim is obligatory.
i have spend over a day trying to get this working, over it .
@neverpanic Thank you for clear explanation. I think it worth a notice on the Installation guide, I created a pull request for that #1846.
@juztin Either you did not have PATH set with MacPorts or you did not use port select python python27
to get the symlink set up that you manually made. I was able to install on a clean (Yosemite) OS X machine with the latest MacPorts and all I did was install vim, python27, and cmake from MacPorts, clone this repository, and ran the cmake command I had as before.
The following post resolved the issue for me, thanks to @d0u9.
http://www.d0u9.xyz/solution-to-getting-vim-caught-deadly-signal-abrt-after-install/
Back at it again 6 months later. There is not a great solution for those using MacPorts right now as MacPorts team does not want to support UCS 4 (wide) builds of Python 2.7 (there are a lot of conflicting packages). This means you can get this to work with the following but there is no support from MacPorts team if Python acts weird for you otherwise or if dependencies break because you have +ucs4
for your Python build.
Use the following:
port install python27 +readline
port install vim +python27
./install.py --gocode-completer --clang-completer --tern-completer
The only way to fix this is to patch YCM to not look for a UCS-4 build of Python (which is actually what comes with OS X too).