wincent / command-t

⌨️ Fast file navigation for Neovim and Vim
BSD 2-Clause "Simplified" License
2.74k stars 317 forks source link

Could not load C Extension #368

Closed vicentealencar closed 4 years ago

vicentealencar commented 4 years ago

I've been a long time Command-T user (since 2011 or so). These were the steps I followed to install command-t on my Mac after recently factory resetting it:

  1. git clone
  2. cd command-t
  3. rake make
  4. Launch vim and press leader-T EXPECTED: List of files shows up VERIFIED: Following error message:
    command-t.vim could not load the C extension.
    Please see INSTALLATION and TROUBLE-SHOOTING in the help.
    Vim Ruby version: 2.7.0-p0
    For more information type:    :help command-t

Output from running :ruby puts "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" on vim: 2.7.0-p0

Output from ruby --version: ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin17]

OS: OS X 10.13.6

The issue reproduces consistently.

wincent commented 4 years ago

Just guessing, is that homebrew-installed Ruby? Which Vim version is this and how was it installed?

I'm using the system ruby on macOS 10.13.6 myself (which is ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin17]), and that obviously works with the Apple-provided Vim (ie. /usr/bin/vim):

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 25 2019 20:35:29)
Included patches: 1-503, 505-680, 682-1283, 1365
Compiled by root@apple.com

I also have homebrew-installed Vim (/usr/local/bin/vim) for some strange reason, but I don't use it. That one uses Ruby 2.6.5-p114, so Command-T won't work with it due to a version mismatch.

I'm using homebrew-install Neovim as my daily drive, and for some reason, that one links against the system Ruby (I guess via the neovim gem, which is installed at the system level), so Command-T works there.

All of which is to say that things should work if the versions match up. What's the full console output of your build process (do make clean first)? And full output of vim --version?

vicentealencar commented 4 years ago

I actually installed that version of Ruby using rbenv and I installed MacVim using homebrew.

vicente@admins-MacBook-Pro ~ % vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Mar  3 2020 21:28:44)
macOS version
Included patches: 1-319
Compiled by Homebrew
Huge version with MacVim GUI.  Features included (+) or not (-):
+acl               +file_in_path      +mouse_urxvt       -tag_any_white
+arabic            +find_in_path      +mouse_xterm       +tcl
+autocmd           +float             +multi_byte        +termguicolors
+autochdir         +folding           +multi_lang        +terminal
-autoservername    -footer            -mzscheme          +terminfo
+balloon_eval      +fork()            +netbeans_intg     +termresponse
+balloon_eval_term +fullscreen        +num64             +textobjects
+browse            -gettext           +odbeditor         +textprop
++builtin_terms    -hangul_input      +packages          +timers
+byte_offset       +iconv             +path_extra        +title
+channel           +insert_expand     +perl              +toolbar
+cindent           +job               +persistent_undo   +transparency
+clientserver      +jumplist          +popupwin          +user_commands
+clipboard         +keymap            +postscript        +vartabs
+cmdline_compl     +lambda            +printer           +vertsplit
+cmdline_hist      +langmap           +profile           +virtualedit
+cmdline_info      +libcall           -python            +visual
+comments          +linebreak         +python3           +visualextra
+conceal           +lispindent        +quickfix          +viminfo
+cryptv            +listcmds          +reltime           +vreplace
+cscope            +localmap          +rightleft         +wildignore
+cursorbind        +lua               +ruby              +wildmenu
+cursorshape       +menu              +scrollbind        +windows
+dialog_con_gui    +mksession         +signs             +writebackup
+diff              +modify_fname      +smartindent       -X11
+digraphs          +mouse             -sound             -xfontset
+dnd               +mouseshape        +spell             +xim
-ebcdic            +mouse_dec         +startuptime       -xpm
+emacs_tags        -mouse_gpm         +statusline        -xsmp
+eval              -mouse_jsbterm     -sun_workshop      -xterm_clipboard
+ex_extra          +mouse_netterm     +syntax            -xterm_save
+extra_search      +mouse_sgr         +tag_binary
-farsi             -mouse_sysmouse    -tag_old_static
   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. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/readline/lib -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/readline/lib  -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon       -lm  -lncurses -liconv -framework AppKit  -L/usr/local/opt/lua/lib -llua5.3 -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl  -L/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin -lpython3.7m -framework CoreFoundation -F/System/Library/Frameworks -framework Tcl -framework CoreFoundation -lruby.2.7
vicentealencar commented 4 years ago

I just realized that I actually have two different ruby2.7.0 installations on my machine (one of them from homebrew and another one from rbenv) and I guess that might be the reason why command-t isn't working. I cant really test this hypothesis right now though. I will give it a try soon.

wincent commented 4 years ago

I cant really test this hypothesis right now though. I will give it a try soon.

Sounds very likely. 🤞

vicentealencar commented 4 years ago

Alright, this is what I did:

  1. Added the homebrew ruby installation to my PATH
  2. cd'ed into command-t
  3. ran rake clean
  4. ran rake make
  5. Launched vim
  6. Ran :CommandT

CommandT works now. So yeah, apparently the issue was due to having two different ruby installations on my machine. Closing this issue for now. Thanks for the help!