Closed adamsx97 closed 5 years ago
Other fix method tried: Remove and reinstall all following: vim, ruby, rvm and command-t plugin
@wincent Would you please help me out? thank you!
You've already done all the things I would have tried, except perhaps for building Vim and Command-T with the system Ruby instead of RVM, which tends to complicate things.
I'm not on Mojave myself but others have reported some success with it; look at #341, for example. Closing this one in any case as we may as well centralize all discussion in that issue.
Sorry to go grave digging on an issue this old but it is the first one which comes up for this particular issue.
If you have followed all the steps regarding matching ruby versions then this might be an issue with not having watchman
installed.
I performed the following to get rid of the watchman
compilation issue:
brew update
brew install watchman
/usr/local/opt/ruby/bin/ruby extconf.rb
make clean
make
This resulted in a successful response of:
linking shared-object ext.bundle
@cfrank The problem has already been solved. The problem was that Mac OS has two separate ruby environments. One is under the system OS_ruby and the other is the brew_ruby.
The fixing method is: Step 1: uninstall ruby from brew, and purge all ruby configurations and paths. Step 2: Then install ruby from either rvm, rbenv or any other ruby version controller. Step 3: set brew's ruby path to the OS_ruby you installed. It will fix the problem. (Do not install ruby from brew)
After that re-compile command-t and try it in vim, it should work.
I'm running into this issue now because macvim just added a ruby dependency: https://github.com/Homebrew/homebrew-core/pull/45624/files (and so I suspect more people will run into this soon)
I can't figure out what @adamsx97 meant by step 3, and can't find any resources that talk about "brew's ruby path". I've installed macvim, force-removed the brew ruby dependency, and have the vim ruby version installed via rvm and currently used. ruby -v
matches the version I expect (in rvm), which ruby
points to the binary in the corresponding rvm folder, and the error message in the command-t "could not load" error shows only the vim ruby number (presumably because the expected number matched). Under these circumstances, it doesn't seem like any other ruby installations should be involved...
Can someone point me in the right direction to investigate? What's the root cause of the watchman_raise_system_call_error
error with multiple rubies involved? It does seem like brew's opinion is that brew ruby /should/ be installed (see e.g. https://github.com/Homebrew/homebrew-core/issues/22596), and I can't find anything on making brew allow rvm ruby to meet its dependency, so how can this all be made compatible?
I have fixed the compilation such that this is now running, though notably the watchman warning continues to show up. The warning may be a red herring?
I've created a PR to add what worked for me to the instructions: https://github.com/wincent/command-t/pull/361
@bmulholland Sorry for all the confusion, I will try to explain it clearly. First and foremost, I am not using macvim, and I am using the original vim installed with brew. Also, this is no longer my latest solution.
I assume that you selecting macvim because the original vim did not come with ruby support. In fact, you can add ruby support to vim easily. Although I could not find my original resource of adding ruby support to vim, here is something similar that you can reference from. https://junegunn.kr/2013/09/installing-vim-with-ruby-support
For my old solution, I uninstalled the brew_ruby and config brew applications to use system OS_ruby. However, I would have to manually use rvm to update or set global/local ruby version from directory to directory. This method is good if you have multiple ruby dependent processes and need flexibility. However, all my ruby applications can be run on the latest ruby version, so I moved on to my latest solution.
In short, I moved back to ruby vim and set it as my global supported ruby source, so I no longer have to manually manage my ruby configs and it's version control goes with brew upgrades. Here is the method:
# Use brew installed ruby as system ruby version
export PATH="/usr/local/opt/ruby/bin/:$PATH"
To make our favorite tool command-T work again. Simply recompile the plugin by entering the following codes:
$cd ~/.vim/bundle/command-t
$rake clean && rake make
You can ignore the warnings, and the plugin should be functional now.
Thanks for the detail @adamsx97 ! I think your current solution is approximately the same as the one I've used - using brew's ruby for compiling command-t - with the main difference being that your way sets the global ruby path to brew's ruby. I think that's equivalent to using rvm (as I do) and using the "system" ruby with rvm use system
.
All that said, while this approach makes command-t work functionally, it does still show the watchman warning while compiling. It's just apparently harmless.
I still have the problem with MacVim 8.2 (1-539):
command-t.vim could not load the C extension.
Please see INSTALLATION and TROUBLE-SHOOTING in the help.
Vim Ruby version: 2.7.1-p83
For more information type: :help command-t
But I'm able to have the watchman.c warning go away by adding this line near the top of the watchman.c file:
// Line 8 of watchman.c, shortly after #include "watchman.h".
void watchman_raise_system_call_error(int) __attribute__((noreturn));
This is a gcc attribute that helps the compiler optimize code for functions that don't return. I use brew install macvim
to install my version of vim, so I don't know if it's appropriate to add to watchman.c
for everyone.
System Info
Symptom
Commands:
Output: With a warning
Commands:
Output from vim:
Other fix method tried: Change ruby version with rvm
Command:
Command-t compiles with no warning, but vim has different output: