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

Crash unless "rvm use system" #175

Closed
mikabytes opened this issue Oct 1, 2015 · 10 comments
Closed

Crash unless "rvm use system" #175

mikabytes opened this issue Oct 1, 2015 · 10 comments

Comments

@mikabytes
Copy link

Command-t was compiled with 2.1.2 and works most of the time

This works

rvm use system
ruby -v   # ruby 2.1.2p95 (2014-05-08) [x86_64-linux-gnu]
vim

This does not work

rvm use ruby-1.9.3-p545
vim

The command above yields the following message:

Error detected while processing ~/.vim/bundle/command-t/autoload/commandt.vim:
line  218:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
Error detected while processing function commandt#CommandTShowFileFinder:
line    2:
NoMethodError: undefined method `show_file_finder' for nil:NilClass

Naturally I want to use a specific Ruby for my project while still running Vim editor using the system default. How can I achieve this?

@wincent
Copy link
Owner

wincent commented Oct 1, 2015

Are you using some kind of plug-in manager to perform an auto-install step?

Nothing should be invoking or involving anything in the Gem namespace, as Command-T doesn't use any RubyGems. Do you have the command-t RubyGem installed? (Perhaps you shouldn't, as it isn't necessary, and perhaps its presence is interfering with one of the require statements in Command-T)

Finally, what's the output of vim --version. I wonder if you are using dynamically linked Ruby and that is somehow pulling in the wrong version.

@mikabytes
Copy link
Author

Thank you so much for your response and help.

I can no longer reproduce this error. Strangely, it appear to have self-healed.

command-t RubyGem is not installed, and vim --version says it's linked to ruby-2.1.

@wincent
Copy link
Owner

wincent commented Oct 6, 2015

Glad to hear you got it sorted out.

@mikabytes
Copy link
Author

The issue came back yesterday. Same scenario as above, using "rvm use system" solves the problem. I'm so grateful for your help so far, do you have any other ideas of where I might start looking for the problem?

I don't have any plug-in manager other than Pathogen.

The error message seems to be quite specific, issue being somewhere along commandt#CommandTShowFileFinder. Any ideas?

@mikabytes mikabytes reopened this Oct 9, 2015
@wincent
Copy link
Owner

wincent commented Oct 9, 2015

What's the full output of:

  • vim --version (on the command line).
  • :ruby puts "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" (inside Vim).
  • make clean && ruby extconf.rb && make when you build Command-T.
  • ruby --version (on the command line, when you build Command-T).

Also, what is in the metadata.rb file that gets created in the directory where you built Command-T?

@mikabytes
Copy link
Author

vim --version

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Dec  9 2014 17:36:41)
Included patches: 1-488
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by buildd@
Huge version with GTK2-GNOME GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +syntax
+arabic          +file_in_path    +mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
+balloon_eval    +float           +mouse_urxvt     -tag_any_white
+browse          +folding         +mouse_xterm     +tcl
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         +gettext         -mzscheme        +textobjects
+clientserver    -hangul_input    +netbeans_intg   +title
+clipboard       +iconv           +path_extra      +toolbar
+cmdline_compl   +insert_expand   +perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +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      -sniff           +xsmp_interact
+eval            +mouse_dec       +startuptime     +xterm_clipboard
+ex_extra        +mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    +xpm
   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"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/freetype2  -D_REENTRANT -DORBIT2=1 -pthread -I/usr/include/libgnomeui-2.0 -I/usr/include/gnome-keyring-1 -I/usr/include/libbonoboui-2.0 -I/usr/include/libxml2 -I/usr/include/libgnome-2.0 -I/usr/include/libbonobo-2.0 -I/usr/include/bonobo-activation-2.0 -I/usr/include/orbit-2.0 -I/usr/include/libgnomecanvas-2.0 -I/usr/include/gail-1.0 -I/usr/include/libart-2.0 -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/gnome-vfs-2.0 -I/usr/lib/x86_64-linux-gnu/gnome-vfs-2.0/include -I/usr/include/gconf/2 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include    -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1     -I/usr/include/tcl8.6  -D_REENTRANT=1  -D_THREAD_SAFE=1  -D_LARGEFILE64_SOURCE=1  
Linking: gcc   -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -L/build/buildd/ruby2.1-2.1.2/debian/lib -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E  -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim   -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype   -lgnomeui-2 -lSM -lICE -lbonoboui-2 -lgnome-2 -lpopt -lbonobo-2 -lbonobo-activation -lORBit-2 -lgnomecanvas-2 -lart_lgpl_2 -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lfontconfig -lfreetype -lgdk_pixbuf-2.0 -lgnomevfs-2 -lgconf-2 -lgthread-2.0 -lgmodule-2.0 -lgobject-2.0 -lglib-2.0  -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lnsl  -lselinux  -lacl -lattr -lgpm -ldl  -L/usr/lib -llua5.2 -Wl,-E  -fstack-protector -L/usr/local/lib  -L/usr/lib/x86_64-linux-gnu/perl/5.20/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python2.7/config-x86_64-linux-gnu -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions  -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lieee -lm -lruby-2.1 -lpthread -lgmp -ldl -lcrypt -lm    
:ruby puts "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"

2.1.2-p95
rvm use system && make clean && ruby extconf.rb && make

Now using system ruby.
checking for float.h... yes
checking for ruby.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for fcntl.h... yes
checking for stdint.h... yes
checking for sys/errno.h... yes
checking for sys/socket.h... yes
checking for ruby/st.h... yes
checking for st.h... yes
checking for pthread_create() in -lpthread... yes
creating Makefile
compiling match.c
compiling watchman.c
compiling ext.c
compiling matcher.c
linking shared-object ext.so
ruby --version
ruby 2.1.2p95 (2014-05-08) [x86_64-linux-gnu]
cat metadata.rb

# This file was generated by extconf.rb
module CommandT
  module Metadata
    EXPECTED_RUBY_VERSION = "2.1.2"
    EXPECTED_RUBY_PATCHLEVEL = 95
    UNKNOWN = false
  end # module Metadata
end # module CommandT

@wincent
Copy link
Owner

wincent commented Oct 9, 2015

All of that looks reasonable to me. I guess the only other thing that occurs to me is to check for differences in the output of :!export inside Vim when the problem is manifesting (ie. using a non-system Ruby) and when it is not.

@NicholasTD07
Copy link

@mikaelwikman

I ran into the same problem you have. Then I remembered that:
0. First, Vim and Command-T must be built with same version of Ruby. Check this PR out. #145
0. Second, for people using RVM, you need to install a version of Ruby like this rvm install VERSION --enable-shared
0. Then, you need to reinstall Vim, brew uninstall vim && brew install vim
0. Finally, re-compile Command-t, make clean && ruby extconf.rb && make

References
VIM crashes when editing ruby files // search mattflo

@wincent
Copy link
Owner

wincent commented Dec 22, 2015

Going to close this optimistically on the assumption that you were able to resolve the miscompilation.

@wincent wincent closed this as completed Dec 22, 2015
@mikabytes
Copy link
Author

Thanks Wincent, the issue came and disappeared, came again. Was driving me nuts. Finally someone suggested to just try using chruby instead of RVM. I haven't seen the issue since, but I'm still not quite sure what the problem was.

Anyway, great thanks for the help!

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