ycm-core / YouCompleteMe

A code-completion engine for Vim
http://ycm-core.github.io/YouCompleteMe/
GNU General Public License v3.0
25.43k stars 2.81k forks source link

vim crashes with signal ABRT #2975

Closed mklassen closed 6 years ago

mklassen commented 6 years ago

Issue Prelude

Please complete these steps and check these boxes (by putting an x inside the brackets) before filing your issue:

Thank you for adhering to this process! It ensures your issue is resolved quickly and that neither your nor our time is needlessly wasted.

Issue Details

vim crashes on startup when including YCM plugin

Upgraded Homebrew packages, Xcode and macOS to latest versions.

Crashes were isolated to YCM, by using a minimal ~/.vimrc

set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/vundle
call vundle#begin()

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

" Removing the following line prevents startup crashes
Plugin 'Valloric/YouCompleteMe'

call vundle#end()            " required
filetype plugin indent on    " required

No crash.

$ /Applications/MacVim.app/Contents/MacOS/Vim
Vim: Caught deadly signal ABRT
Vim: Finished.
Abort trap: 6

Diagnostic data

$ lldb /Applications/MacVim.app/Contents/MacOS/Vim
(lldb) target create "/Applications/MacVim.app/Contents/MacOS/Vim"
Current executable set to '/Applications/MacVim.app/Contents/MacOS/Vim' (x86_64).
(lldb) run
Process 34159 launched: '/Applications/MacVim.app/Contents/MacOS/Vim' (x86_64)
Fatal Python error: Py_Initialize: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007fff94b4e380 (most recent call first):
Process 32581 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x00007fff5c671b6e libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill:
->  0x7fff5c671b6e <+10>: jae    0x7fff5c671b78            ; <+20>
    0x7fff5c671b70 <+12>: movq   %rax, %rdi
    0x7fff5c671b73 <+15>: jmp    0x7fff5c668b00            ; cerror_nocancel
    0x7fff5c671b78 <+20>: retq
Target 0: (Vim) stopped.

Output of vim --version

$ /Applications/MacVim.app/Contents/MacOS/Vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Mar 25 2018 06:11:16)
macOS version
Included patches: 1-1633
Compiled by Homebrew
Huge version with MacVim GUI.  Features included (+) or not (-):
+acl               +farsi             +mouse_netterm     +tag_binary
+arabic            +file_in_path      +mouse_sgr         +tag_old_static
+autocmd           +find_in_path      -mouse_sysmouse    -tag_any_white
-autoservername    +float             +mouse_urxvt       +tcl
+balloon_eval      +folding           +mouse_xterm       +termguicolors
+balloon_eval_term -footer            +multi_byte        +terminal
+browse            +fork()            +multi_lang        +terminfo
++builtin_terms    +fullscreen        -mzscheme          +termresponse
+byte_offset       -gettext           +netbeans_intg     +textobjects
+channel           -hangul_input      +num64             +timers
+cindent           +iconv             +odbeditor         +title
+clientserver      +insert_expand     +packages          +toolbar
+clipboard         +job               +path_extra        +transparency
+cmdline_compl     +jumplist          +perl              +user_commands
+cmdline_hist      +keymap            +persistent_undo   +vertsplit
+cmdline_info      +lambda            +postscript        +virtualedit
+comments          +langmap           +printer           +visual
+conceal           +libcall           +profile           +visualextra
+cryptv            +linebreak         -python            +viminfo
+cscope            +lispindent        +python3           +vreplace
+cursorbind        +listcmds          +quickfix          +wildignore
+cursorshape       +localmap          +reltime           +wildmenu
+dialog_con_gui    -lua               +rightleft         +windows
+diff              +menu              +ruby              +writebackup
+digraphs          +mksession         +scrollbind        -X11
+dnd               +modify_fname      +signs             -xfontset
-ebcdic            +mouse             +smartindent       +xim
+emacs_tags        +mouseshape        +startuptime       -xpm
+eval              +mouse_dec         +statusline        -xsmp
+ex_extra          -mouse_gpm         -sun_workshop      -xterm_clipboard
+extra_search      -mouse_jsbterm     +syntax            -xterm_save
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe  -DMACOS_X -DMACOS_X_DARWIN  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang   -L.             -L /BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.Internal.sdk/usr/local/libressl/lib -L/BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.Internal.sdk/usr/local/lib -L.             -L /BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.Internal.sdk/usr/local/libressl/lib -L/BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.Internal.sdk/usr/local/lib  -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon       -lm  -lncurses -liconv -framework AppKit   -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl  -L/usr/local/opt/python/Frameworks/Python.framework/Versions/3.6/lib/python3.6/config-3.6m-darwin -lpython3.6m -framework CoreFoundation -F/System/Library/Frameworks -framework Tcl -framework CoreFoundation -framework Ruby

Output of YcmDebugInfo

Unable to get output as vim will not start with YCM enabled

Contents of YCM, ycmd and completion engine logfiles

Unable to get output as vim will not start with YCM enabled

OS version, distribution, etc.

macOS 10.13.4

$ uname -a
Darwin elpis.imaging.robarts.ca 17.5.0 Darwin Kernel Version 17.5.0: Mon Mar  5 22:24:32 PST 2018; root:xnu-4570.51.1~1/RELEASE_X86_64 x86_64
$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 9.3.0.0.1.1521514116
volume: /
location: /
install-time: 1522437091
groups: com.apple.FindSystemFiles.pkg-group
$ brew info macvim
macvim: stable 8.0-146 (bottled), HEAD
GUI for vim, made for macOS
https://github.com/macvim-dev/macvim
/usr/local/Cellar/macvim/8.0-146 (2,156 files, 34.4MB) *
  Poured from bottle on 2018-04-03 at 14:16:21
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/macvim.rb
==> Dependencies
Recommended: cscope ✔, python ✔
Optional: lua ✘, luajit ✘, python@2 ✔
==> Requirements
Build: xcode ✔
==> Options
--with-lua
    Build with lua support
--with-luajit
    Build with luajit support
--with-override-system-vim
    Override system vim
--with-python@2
    Build with python@2 support
--without-cscope
    Build without cscope support
--without-python
    Build without python support
--HEAD
    Install HEAD version
$ brew info python
python: stable 3.6.5 (bottled), devel 3.7.0b3, HEAD
Interpreted, interactive, object-oriented programming language
https://www.python.org/
/usr/local/Cellar/python/3.6.5 (4,709 files, 99.5MB) *
  Poured from bottle on 2018-04-04 at 13:14:17
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/python.rb
==> Dependencies
Build: pkg-config ✔, sphinx-doc ✘
Required: gdbm ✔, openssl ✔, readline ✔, sqlite ✔, xz ✔
Optional: tcl-tk ✘
==> Options
--with-tcl-tk
    Use Homebrew's Tk instead of macOS Tk (has optional Cocoa and threads support)
--devel
    Install development version 3.7.0b3
--HEAD
    Install HEAD version
==> Caveats
Python has been installed as
  /usr/local/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /usr/local/opt/python/libexec/bin

If you need Homebrew's Python 2.7 run
  brew install python@2

Pip, setuptools, and wheel have been installed. To update them run
  pip3 install --upgrade pip setuptools wheel

You can install Python packages with
  pip3 install <package>
They will install into the site-package directory
  /usr/local/lib/python3.6/site-packages

See: https://docs.brew.sh/Homebrew-and-Python

Output of build/install commands

https://gist.github.com/mklassen/896f16f54e508862c8e51d56b61f733e

micbou commented 6 years ago

Python 3 support on the latest version of MacVim (8.0-146) is broken. I can reproduce the crash with the command:

mvim -u NONE -c "py3 pass"

which results in

Fatal Python error: Py_Initialize: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007fffa4432380 (most recent call first):
Vim: Caught deadly signal ABRT
Vim: Finished.

The solution is to specify the right Python home with the pythonthreehome option in vimrc:

set pythonthreehome=/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6
CatSunshine commented 6 years ago

this helps, thanks a lot. how grateful I am.