Closed yudaprama closed 5 years ago
You could try a clean rebuild. The Ruby version most likely changed in Mojave.
I did with no luck
rake clean
rake make
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby extconf.rb
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 ext.c
compiling heap.c
compiling match.c
compiling matcher.c
compiling watchman.c
linking shared-object ext.bundle
I still suspect a version mismatch. You could try rebuilding Vim from source, and if you're using rvm or similar, don't...
I don't use rvm or similar
Mac ruby version:
$ ruby --version
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
I'm not on Mojave yet, but when I do get onto it I'll dig into this (unless somebody else who already has it can chime in first).
@yudaprama This issue is happening because command-t build and vim compiled ruby version is mismatched.
Figure out your vim ruby version by
Typing :ruby puts RUBY_VERSION
inside vim.
Then go to command-t installation directory and check ruby version.
If it's not matching, change your ruby version(Using Rbenv or RVM) and match it with the version you've got from Vim then do
rake clean
rake make
This fixed the issue for me.
:ruby puts RUBY_VERSION
$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
$ rake clean
$ rake make --trace
** Invoke make (first_time)
** Execute make
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby extconf.rb
checking for float.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/$(RUBY_BASE_NAME)
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:571:in `block in try_compile'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:524:in `with_werror'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:571:in `try_compile'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:1144:in `block in find_header'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:320:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:320:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:1143:in `find_header'
from extconf.rb:18:in `header'
from extconf.rb:25:in `<main>'
rake aborted!
Command failed with status (1): [/System/Library/Frameworks/Ruby.framework/...]
/Library/Ruby/Gems/2.3.0/gems/rake-10.4.2/lib/rake/file_utils.rb:66:in `block in create_shell_runner'
/Library/Ruby/Gems/2.3.0/gems/rake-10.4.2/lib/rake/file_utils.rb:57:in `sh'
/Library/Ruby/Gems/2.3.0/gems/rake-10.4.2/lib/rake/file_utils_ext.rb:37:in `sh'
/Library/Ruby/Gems/2.3.0/gems/rake-10.4.2/lib/rake/file_utils.rb:96:in `ruby'
/Library/Ruby/Gems/2.3.0/gems/rake-10.4.2/lib/rake/file_utils_ext.rb:37:in `ruby'
/Users/yuda/.vim/bundle/command-t/Rakefile:84:in `block (2 levels) in <top (required)>'
/Users/yuda/.vim/bundle/command-t/Rakefile:83:in `chdir'
/Users/yuda/.vim/bundle/command-t/Rakefile:83:in `block in <top (required)>'
/Library/Ruby/Gems/2.3.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/Library/Ruby/Gems/2.3.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/Library/Ruby/Gems/2.3.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/Library/Ruby/Gems/2.3.0/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/Library/Ruby/Gems/2.3.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/Library/Ruby/Gems/2.3.0/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/Library/Ruby/Gems/2.3.0/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/Library/Ruby/Gems/2.3.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Library/Ruby/Gems/2.3.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/Library/Ruby/Gems/2.3.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/Library/Ruby/Gems/2.3.0/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/Library/Ruby/Gems/2.3.0/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/Library/Ruby/Gems/2.3.0/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/Library/Ruby/Gems/2.3.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Library/Ruby/Gems/2.3.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/Library/Ruby/Gems/2.3.0/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/usr/bin/rake:22:in `load'
/usr/bin/rake:22:in `<main>'
Tasks: TOP => make
This is mojave issue
mkmf.log shows:
"xcrun clang -o conftest -I/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin18 -I/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby/backward -I/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -g -Os -pipe -DHAVE_GCC_ATOMIC_BUILTINS conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib -L. -lruby.2.3.0 -lpthread -ldl -lobjc "
In file included from conftest.c:1:
In file included from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby.h:33:
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby/ruby.h:24:10: fatal error: 'ruby/config.h' file not found
#include "ruby/config.h"
^~~~~~~~~~~~~~~
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
Problem is, correct header file for config.h
is there, but in old directory: universal-darwin17
not in new mojave directory universal-darwin18
. And we can't rename it or make symlink due to SIP.
@yudaprama
I was having a similar issue when running :ruby puts RUBY_VERSION
upgrading to Mojave, except that I was able to generate a Makefile successfully. This was on vim 8.0 that was included with OSX and ruby 2.3.7-p456 (also bundled with OSX).
Running ,-T
gave the same error command-t.vim could not load the C-extension
and no EXPECTED VERSION
line.
I fixed this by installing ruby 2.5.3 and Vim 8.1 from homebrew and restarting my session.
Closing this one as seems to be working fine once the version mismatch is addressed.
I'm running into the same issue here, even after accounting for the same versions.
# ruby version output
╰─$ ruby --version 1 ↵
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin18]
# see ruby version mentioned matches ruby version above
command-t.vim could not load the C extension.
Please see INSTALLATION and TROUBLE-SHOOTING in the help.
Vim Ruby version: 2.5.3-p105
For more information type: :help command-t
Press ENTER or type command to continue
I'm also on Mojave and use RVM. I've verified I'm using the correct ruby to install the extension.
Just to confirm that the following worked for me:
brew install vim@8.7
cd ~/.vim/bundle/command-t/ruby/command-t/ext/command-t
rbenv local 2.5.3
make clean
ruby extconf.rb
make
I don't really use any plugins for vim other than Command-t. I had to live without it for an hour or so while Xcode installed and it was really not a life worth living. : )
I'm also getting a variant of these errors after upgrading to mojave:
$ ruby -v
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin18]
$ cd ~/.vim/bundle/command-t/ruby/command-t/ext/command-t
$ make clean
$ ruby extconf.rb
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
$ make
compiling ext.c
compiling heap.c
compiling match.c
compiling matcher.c
compiling watchman.c
linking shared-object ext.bundle
in vim
:ruby puts RUBY_VERSION
2.5.3
:CommandT
command-t.vim could not load the C extension.
Please see INSTALLATION and TROUBLE-SHOOTING in the help.
Vim Ruby version: 2.5.3-p105
For more information type: :help command-t
Press ENTER or type command to continue
The versions look aligned. I don't understand why it's not working.
I added some debug statements and noticed that on retry the following snippet in .vim/bundle/command-t/autoload/commandt.vim
is throwing
incompatible library version - /Users/pauldb/.vim/bundle/command-t/ruby/command-t/ext/command-t/ext.bundle
/usr/local/Cellar/ruby/2.5.3_1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/usr/local/Cellar/ruby/2.5.3_1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
eval:18:in `<main>'
at require 'command-t/ext'
:
begin
require 'command-t'
# Make sure we're running with the same version of Ruby that Command-T was
# compiled with.
patchlevel = defined?(RUBY_PATCHLEVEL) ? RUBY_PATCHLEVEL : nil
if CommandT::Metadata::UNKNOWN == true || (
CommandT::Metadata::EXPECTED_RUBY_VERSION == RUBY_VERSION &&
CommandT::Metadata::EXPECTED_RUBY_PATCHLEVEL == patchlevel
)
require 'command-t/ext' # eager load, to catch compilation problems early
$command_t = CommandT::Controller.new
else
$command_t = CommandT::Stub.new
end
rescue LoadError
load_path_modified = false
::VIM::evaluate('&runtimepath').to_s.split(',').each do |path|
ext = "#{path}/ruby/command-t/ext"
if !$LOAD_PATH.include?(ext) && File.exist?(ext)
$LOAD_PATH << ext
load_path_modified = true
end
lib = "#{path}/ruby/command-t/lib"
if !$LOAD_PATH.include?(lib) && File.exist?(lib)
$LOAD_PATH << lib
load_path_modified = true
end
end
retry if load_path_modified
$command_t = CommandT::Stub.new
end
I'm not quite sure what to make of it.
Leaving this here for future spelunkers-
As of today, the current brew installed version of macvim (8.1-153) is installed with osx mojave's system ruby: that is, ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
Notably, this is different from 2.3.7p456
installed from rvm: ruby 2.3.7p456 (2018-03-28 revision 63024) [x86_64-darwin18]
. Apparently, that matters.
When you correctly use OSX mojave's system ruby to compile command-t's c extension, you get the problem described by @yudaprama. That is, the make
fails because it can't find a header file, because Mojave uses universal-darwin18
and not universal-darwin17
, which is what is currently included with Xcode. This is located at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0
for me.
So this is pretty sketch but I copied over the entire directory sudo cp -r universal-darwin17 universal-darwin18
. With that, the make
now succeeds and Command-T works again for me.
I also had the same error as yudaprama above and these are the steps that I took to get command t working again. I tried a bunch of different things so I'm not sure what the exact fix was - this is a list of everything that I did.
For reference, I use rbenv, vim 8.0, and my system ruby was set to ruby 2.3.7p456 (2018-03-28 revision 63024) [x86_64-darwin18] after I updated to Mojave yesterday.
The error that I got when I tried to run command-t said:
Vim Ruby version: 2.3.7-p456
Expected version 2.3.3-p222
I was not able to get the ruby version inside of vim using :ruby 1
and would get the error that yudaprama has shown at the beginning of this issue.
First I tried to just simply rebuild command t using:
cd ~/.vim/bundle/command-t/ruby/command-t/ext/command-t
make clean
ruby extconf.rb
make
That did not work and gave me this error:
Checking for float.h... /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
Then I did
rbenv install 2.3.3
rbenv global 2.3.3
and then the make clean
steps from above. When I tried to open command-t in a new shell it still gave the same error as above.
I tried oliversong's solution from above, and then redid make clean
but it was still the same error as above.
I tried to upgrade vim via brew - but then it told me that I had to upgrade to the latest (10.1) Xcode. I did the upgrade and then ran xcode-select --install
at the suggestion of our dear leader wincent. Command t still did not work.
I looked closer at the error and realized that it had something to do with ruby 2.3.0.
So I ran:
rbenv install 2.3.0
rbenv global 2.3.0
and the rest of the make clean steps for command-t
Command t still did not work after this BUT I was able to see the output of :ruby 1
and see that vim was actually trying to use ruby 2.6.0.
What finally worked:
brew upgrade ruby-build
rbenv install 2.6.0
rbenv global 2.6.0
and the make clean steps for command-t
Overall, I'm not really sure what exactly I did that fixed command-t but at least it works! And now I can tell my coworkers to go away when they say, "you shouldn't waste your time with vim", and "just switch to VS code". Bleh.
Anyways, I hope that this helps someone else.
And now I can tell my coworkers to go away when they say, "you shouldn't waste your time with vim", and "just switch to VS code". Bleh.
Glad to hear you got it sorted. Thanks for sharing your trouble-shooting steps.
I'm also having this issue - Mojave, OSX built-in version of Vim, system Ruby, clean rebuild of Command-T.
Weirdly, I found that if you copy the vim binary from /usr/bin/vim
to somewhere else, the error doesn't occur with the copied binary 🤔.
As a hacky quick-fix, you can copy the binary to /usr/local/bin/vim
(which will take precedence over /usr/bin/vim
as it's earlier in the PATH).
cp /usr/bin/vim /usr/local/bin/vim
I also did some further investigation, as this made me think the issue is SIP related.
I tried disabling SIP (Boot into Recovery Mode, csrutil disable
) and seeing if it made the issue go away. It didn't stop the issue completely, but significantly more scenarios work with SIP disabled:
Command | SIP Enabled (default) | SIP Disabled |
---|---|---|
vim (/usr/bin/vim) |
ERROR | ERROR |
./vim when in /usr/bin |
ERROR | WORKS |
vi (symlink to /usr/bin/vim) |
ERROR | WORKS |
vim (copied to /usr/local/bin) |
WORKS | WORKS |
I'm probably more confused now than when I started, but maybe someone else can make sense of it.
What finally worked:
brew upgrade ruby-build rbenv install 2.6.0 rbenv global 2.6.0 and the make clean steps for command-t
Overall, I'm not really sure what exactly I did that fixed command-t but at least it works! And now I can tell my coworkers to go away when they say, "you shouldn't waste your time with vim", and "just switch to VS code". Bleh.
Anyways, I hope that this helps someone else.
I skipped the first steps you mentioned and in fact was able to use 2.6.0
to run the make process. I'm curious why it stopped working with 2.6.1
for me.
Mojave 10.14.4
For those of you using RVM, if you use brew to install vim, brew will install ruby as a dependency and use that version of ruby for the install of vim....even if you set RVM before you start, it ignores the RVM version.
There is a comment in the vim brew formula that it will use the first suitable version of Ruby in the PATH. In my experience, this was not the case. Find the version of ruby that brew installed and use that to build your Makefile.
To find the brew installed ruby path look for something similar:
brew info ruby
-----
If you need to have ruby first in your PATH run:
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.zshrc
----
cd ~/.vim/bundle/command-t/ruby/command-t/ext/command-t
make clean #in case you have been banging your head
/usr/local/opt/ruby/bin/ruby extconf.rb
make
@wincent command-T is working again and thank you for creating it!
@jmscholen, thanks for sharing the details. I'm still stubbornly staying on Mavericks. #remain #NoMojexit
@jmscholen Works like a charm! Thank you very much for sharing this 👏 .
Mojave 10.14.4
[...]
cd ~/.vim/bundle/command-t/ruby/command-t/ext/command-t make clean #in case you have been banging your head /usr/local/opt/ruby/bin/ruby extconf.rb make
@wincent command-T is working again and thank you for creating it!
Just minor comment, ruby
executable need not be in /usr/local/opt/ruby/bin/ruby
; mine is in /usr/bin/ruby
.
MacOS Mojave 10.14 Beta (18A384a)
screenshot: